luci-app-passwall2: sync upstream

This commit is contained in:
actions 2024-02-01 03:00:10 +08:00
parent bf95a9f9ca
commit d417673075
8 changed files with 34 additions and 20 deletions

View File

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2 PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.25-1 PKG_VERSION:=1.25-3
PKG_RELEASE:= PKG_RELEASE:=
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \

View File

@ -237,10 +237,8 @@ o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encryp
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "chacha20-poly1305" }) o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "chacha20-poly1305" })
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "xchacha20-poly1305" }) o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "xchacha20-poly1305" })
o = s:option(Flag, option_name("uot"), translate("UDP over TCP"), translate("Need Xray-core or sing-box as server side.")) o = s:option(Flag, option_name("uot"), translate("UDP over TCP"))
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "2022-blake3-aes-128-gcm" }) o:depends({ [option_name("protocol")] = "shadowsocks" })
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "2022-blake3-aes-256-gcm" })
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "2022-blake3-chacha20-poly1305" })
o = s:option(Value, option_name("uuid"), translate("ID")) o = s:option(Value, option_name("uuid"), translate("ID"))
o.password = true o.password = true

View File

@ -231,10 +231,9 @@ if singbox_tags:find("with_shadowsocksr") then
o:depends({ [option_name("protocol")] = "shadowsocksr" }) o:depends({ [option_name("protocol")] = "shadowsocksr" })
end end
o = s:option(Flag, option_name("uot"), translate("UDP over TCP"), translate("Need Xray-core or sing-box as server side.")) o = s:option(Flag, option_name("uot"), translate("UDP over TCP"))
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "2022-blake3-aes-128-gcm" }) o:depends({ [option_name("protocol")] = "socks" })
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "2022-blake3-aes-256-gcm" }) o:depends({ [option_name("protocol")] = "shadowsocks" })
o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "2022-blake3-chacha20-poly1305" })
o = s:option(Value, option_name("uuid"), translate("ID")) o = s:option(Value, option_name("uuid"), translate("ID"))
o.password = true o.password = true

View File

@ -184,7 +184,10 @@ function gen_outbound(flag, node, tag, proxy_table)
version = "5", version = "5",
username = (node.username and node.password) and node.username or nil, username = (node.username and node.password) and node.username or nil,
password = (node.username and node.password) and node.password or nil, password = (node.username and node.password) and node.password or nil,
udp_over_tcp = false, udp_over_tcp = node.uot == "1" and {
enabled = true,
version = 2
} or nil,
} }
end end
@ -735,6 +738,8 @@ function gen_config(var)
local loglevel = var["-loglevel"] or "warn" local loglevel = var["-loglevel"] or "warn"
local logfile = var["-logfile"] or "/dev/null" local logfile = var["-logfile"] or "/dev/null"
local node_id = var["-node"] local node_id = var["-node"]
local server_host = var["-server_host"]
local server_port = var["-server_port"]
local tcp_proxy_way = var["-tcp_proxy_way"] local tcp_proxy_way = var["-tcp_proxy_way"]
local redir_port = var["-redir_port"] local redir_port = var["-redir_port"]
local local_socks_address = var["-local_socks_address"] or "0.0.0.0" local local_socks_address = var["-local_socks_address"] or "0.0.0.0"
@ -862,6 +867,10 @@ function gen_config(var)
local default_outTag = nil local default_outTag = nil
if node then if node then
if server_host and server_port then
node.address = server_host
node.port = server_port
end
if node.protocol == "_shunt" then if node.protocol == "_shunt" then
local rules = {} local rules = {}
@ -879,6 +888,7 @@ function gen_config(var)
password = parsed1.password, password = parsed1.password,
address = parsed1.host, address = parsed1.host,
port = parsed1.port, port = parsed1.port,
uot = "1",
} }
local preproxy_outbound = gen_outbound(flag, _node, preproxy_tag) local preproxy_outbound = gen_outbound(flag, _node, preproxy_tag)
if preproxy_outbound then if preproxy_outbound then
@ -935,6 +945,7 @@ function gen_config(var)
password = parsed1.password, password = parsed1.password,
address = parsed1.host, address = parsed1.host,
port = parsed1.port, port = parsed1.port,
uot = "1",
} }
local _outbound = gen_outbound(flag, _node, rule_name) local _outbound = gen_outbound(flag, _node, rule_name)
if _outbound then if _outbound then
@ -963,10 +974,6 @@ function gen_config(var)
local pre_proxy = nil local pre_proxy = nil
if _node.type ~= "sing-box" then if _node.type ~= "sing-box" then
pre_proxy = true pre_proxy = true
else
if _node.flow == "xtls-rprx-vision" then
pre_proxy = true
end
end end
if pre_proxy then if pre_proxy then
new_port = get_new_port() new_port = get_new_port()

View File

@ -507,6 +507,8 @@ function gen_config(var)
local flag = var["-flag"] local flag = var["-flag"]
local loglevel = var["-loglevel"] or "warning" local loglevel = var["-loglevel"] or "warning"
local node_id = var["-node"] local node_id = var["-node"]
local server_host = var["-server_host"]
local server_port = var["-server_port"]
local tcp_proxy_way = var["-tcp_proxy_way"] local tcp_proxy_way = var["-tcp_proxy_way"]
local redir_port = var["-redir_port"] local redir_port = var["-redir_port"]
local local_socks_address = var["-local_socks_address"] or "0.0.0.0" local local_socks_address = var["-local_socks_address"] or "0.0.0.0"
@ -679,6 +681,10 @@ function gen_config(var)
end end
for k, v in pairs(nodes) do for k, v in pairs(nodes) do
if server_host and server_port then
v.address = server_host
v.port = server_port
end
local node = v local node = v
if node.protocol == "_shunt" then if node.protocol == "_shunt" then
local rules = {} local rules = {}

View File

@ -365,25 +365,30 @@ local api = require "luci.passwall2.api"
url += url_protocol; url += url_protocol;
url += params; url += params;
} else if ((v_type === "Hysteria2") || (v_type === "sing-box" && opt.get(dom_prefix + "protocol").value === "hysteria2")) { } else if ((v_type === "Hysteria2") || (v_type === "sing-box" && opt.get(dom_prefix + "protocol").value === "hysteria2")) {
protocol = "hysteria2";
var v_port = opt.get(dom_prefix + "port"); var v_port = opt.get(dom_prefix + "port");
var params = ""; var params = "";
params += opt.query("sni", dom_prefix + "tls_serverName"); params += opt.query("sni", dom_prefix + "tls_serverName");
params += opt.query("insecure", dom_prefix + "tls_allowInsecure"); params += opt.query("insecure", dom_prefix + "tls_allowInsecure");
var v_password = null;
params += opt.query("obfs", "salamander"); params += opt.query("obfs", "salamander");
if (v_type === "Hysteria2") { if (v_type === "Hysteria2") {
v_password = opt.get("hysteria2_auth_password");
params += opt.query("obfs-password", "hysteria2_obfs"); params += opt.query("obfs-password", "hysteria2_obfs");
params += opt.query("auth", "hysteria2_auth_password");
params += opt.query("pinSHA256", "hysteria2_tls_pinSHA256"); params += opt.query("pinSHA256", "hysteria2_tls_pinSHA256");
} else { } else {
v_password = opt.get(dom_prefix + "hysteria2_auth_password");
params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password"); params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password");
params += opt.query("auth", dom_prefix + "hysteria2_auth_password");
} }
var url = url =
_address + ":" + _address + ":" +
v_port.value + "?" + v_port.value + "?" +
params + params +
"#" + encodeURI(v_alias.value); "#" + encodeURI(v_alias.value);
if (v_password) {
url = encodeURIComponent(v_password.value) + "@" + url
}
} }
if (url) { if (url) {
url = protocol.toLowerCase() + "://" + url; url = protocol.toLowerCase() + "://" + url;

View File

@ -1015,9 +1015,6 @@ msgstr "IV 检查"
msgid "UDP over TCP" msgid "UDP over TCP"
msgstr "TCP 封装 UDP" msgstr "TCP 封装 UDP"
msgid "Need Xray-core or sing-box as server side."
msgstr "需要 Xray-core 或者 sing-box 作为服务器端。"
msgid "Connection Timeout" msgid "Connection Timeout"
msgstr "连接超时时间" msgstr "连接超时时间"

View File

@ -518,6 +518,7 @@ run_socks() {
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g") config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
local _extra_param="-local_http_port $http_port" local _extra_param="-local_http_port $http_port"
} }
[ -n "$relay_port" ] && _extra_param="${_extra_param} -server_host $server_host -server_port $port"
lua $UTIL_SINGBOX gen_config -flag SOCKS_$flag -node $node -local_socks_port $socks_port ${_extra_param} > $config_file lua $UTIL_SINGBOX gen_config -flag SOCKS_$flag -node $node -local_socks_port $socks_port ${_extra_param} > $config_file
ln_run "$(first_type $(config_t_get global_app singbox_file) sing-box)" "sing-box" $log_file run -c "$config_file" ln_run "$(first_type $(config_t_get global_app singbox_file) sing-box)" "sing-box" $log_file run -c "$config_file"
;; ;;
@ -527,6 +528,7 @@ run_socks() {
config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g") config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g")
local _extra_param="-local_http_port $http_port" local _extra_param="-local_http_port $http_port"
} }
[ -n "$relay_port" ] && _extra_param="${_extra_param} -server_host $server_host -server_port $port"
lua $UTIL_XRAY gen_config -flag SOCKS_$flag -node $node -local_socks_port $socks_port ${_extra_param} > $config_file lua $UTIL_XRAY gen_config -flag SOCKS_$flag -node $node -local_socks_port $socks_port ${_extra_param} > $config_file
ln_run "$(first_type $(config_t_get global_app xray_file) xray)" "xray" $log_file run -c "$config_file" ln_run "$(first_type $(config_t_get global_app xray_file) xray)" "xray" $log_file run -c "$config_file"
;; ;;