From ffcc115a64e1fed100ea72d868cf2c1710484741 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 1 Feb 2024 23:35:00 +0800 Subject: [PATCH] update 2024-02-01 23:35:00 --- luci-app-passwall/Makefile | 2 +- .../model/cbi/passwall/client/type/ray.lua | 6 ++--- .../cbi/passwall/client/type/sing-box.lua | 7 +++--- .../luasrc/passwall/util_sing-box.lua | 19 ++++++++++---- .../luasrc/passwall/util_xray.lua | 8 ++++++ .../passwall/node_list/link_share_man.htm | 25 ++++++++++++++----- luci-app-passwall/po/zh-cn/passwall.po | 3 --- .../root/usr/share/passwall/app.sh | 2 ++ .../root/usr/share/passwall/subscribe.lua | 11 ++++++-- .../cbi/passwall2/client/type/sing-box.lua | 14 +++++++++++ .../luasrc/passwall2/util_sing-box.lua | 4 +-- 11 files changed, 74 insertions(+), 27 deletions(-) diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 36e7753d7..a59776914 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=4.73-1 +PKG_VERSION:=4.73-3 PKG_RELEASE:= PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index 45dc8f9b2..a99027b60 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -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")] = "xchacha20-poly1305" }) -o = s:option(Flag, option_name("uot"), translate("UDP over TCP"), translate("Need Xray-core or sing-box as server side.")) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("x_ss_encrypt_method")] = "2022-blake3-aes-128-gcm" }) -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(Flag, option_name("uot"), translate("UDP over TCP")) +o:depends({ [option_name("protocol")] = "shadowsocks" }) o = s:option(Value, option_name("uuid"), translate("ID")) o.password = true diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index 9f93e733a..1f484a638 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -231,10 +231,9 @@ if singbox_tags:find("with_shadowsocksr") then o:depends({ [option_name("protocol")] = "shadowsocksr" }) end -o = s:option(Flag, option_name("uot"), translate("UDP over TCP"), translate("Need Xray-core or sing-box as server side.")) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "2022-blake3-aes-128-gcm" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "2022-blake3-aes-256-gcm" }) -o:depends({ [option_name("protocol")] = "shadowsocks", [option_name("ss_method")] = "2022-blake3-chacha20-poly1305" }) +o = s:option(Flag, option_name("uot"), translate("UDP over TCP")) +o:depends({ [option_name("protocol")] = "socks" }) +o:depends({ [option_name("protocol")] = "shadowsocks" }) o = s:option(Value, option_name("uuid"), translate("ID")) o.password = true diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index 8e9de4d3b..5a961cf80 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -183,7 +183,10 @@ function gen_outbound(flag, node, tag, proxy_table) version = "5", username = (node.username and node.password) and node.username 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 @@ -734,6 +737,8 @@ function gen_config(var) local loglevel = var["-loglevel"] or "warn" local logfile = var["-logfile"] or "/dev/null" 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_redir_port = var["-tcp_redir_port"] local udp_redir_port = var["-udp_redir_port"] @@ -787,6 +792,12 @@ function gen_config(var) local default_outTag = nil if node_id then local node = uci:get_all(appname, node_id) + if node then + if server_host and server_port then + node.address = server_host + node.port = server_port + end + end if local_socks_port then local inbound = { @@ -880,6 +891,7 @@ function gen_config(var) password = parsed1.password, address = parsed1.host, port = parsed1.port, + uot = "1", } local preproxy_outbound = gen_outbound(flag, _node, preproxy_tag) if preproxy_outbound then @@ -936,6 +948,7 @@ function gen_config(var) password = parsed1.password, address = parsed1.host, port = parsed1.port, + uot = "1", } local _outbound = gen_outbound(flag, _node, rule_name) if _outbound then @@ -964,10 +977,6 @@ function gen_config(var) local pre_proxy = nil if _node.type ~= "sing-box" then pre_proxy = true - else - if _node.flow == "xtls-rprx-vision" then - pre_proxy = true - end end if pre_proxy then new_port = get_new_port() diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 9f1abdd3f..37ee5f9d4 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -510,6 +510,8 @@ end function gen_config(var) local flag = var["-flag"] 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"] or "redirect" local tcp_redir_port = var["-tcp_redir_port"] local udp_redir_port = var["-udp_redir_port"] @@ -545,6 +547,12 @@ function gen_config(var) if node_id then local node = uci:get_all(appname, node_id) + if node then + if server_host and server_port then + node.address = server_host + node.port = server_port + end + end if local_socks_port then local inbound = { tag = "socks-in", diff --git a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm index ac4a1061a..762bb6e31 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_list/link_share_man.htm @@ -415,25 +415,38 @@ local api = require "luci.passwall.api" url += url_protocol; url += params; } 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 params = ""; params += opt.query("sni", dom_prefix + "tls_serverName"); params += opt.query("insecure", dom_prefix + "tls_allowInsecure"); - params += opt.query("obfs", "salamander"); + var v_password = null; + if (v_type === "Hysteria2") { - params += opt.query("obfs-password", "hysteria2_obfs"); - params += opt.query("auth", "hysteria2_auth_password"); + v_password = opt.get("hysteria2_auth_password"); params += opt.query("pinSHA256", "hysteria2_tls_pinSHA256"); + var dom_obfs = opt.get("hysteria2_obfs"); + if (dom_obfs && dom_obfs.value != "") { + params += "&obfs=" + "salamander"; + params += opt.query("obfs-password", "hysteria2_obfs"); + } } else { - params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password"); - params += opt.query("auth", dom_prefix + "hysteria2_auth_password"); + v_password = opt.get(dom_prefix + "hysteria2_auth_password"); + var dom_obfs_type = opt.get(dom_prefix + "hysteria2_obfs_type"); + if (dom_obfs_type && dom_obfs_type.value != "") { + params += opt.query("obfs", dom_prefix + "hysteria2_obfs_type"); + params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password"); + } } - var url = + url = _address + ":" + v_port.value + "?" + params + "#" + encodeURI(v_alias.value); + if (v_password) { + url = encodeURIComponent(v_password.value) + "@" + url + } } if (url) { url = protocol.toLowerCase() + "://" + url; diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 2fa8fa21a..6ef2aa8b2 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -1078,9 +1078,6 @@ msgstr "IV 检查" msgid "UDP over TCP" msgstr "TCP 封装 UDP" -msgid "Need Xray-core or sing-box as server side." -msgstr "需要 Xray-core 或者 sing-box 作为服务器端。" - msgid "Connection Timeout" msgstr "连接超时时间" diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index fff3f8024..fb13e91e6 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -594,6 +594,7 @@ run_socks() { config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g") local _args="http_port=$http_port" } + [ -n "$relay_port" ] && _args="${_args} -server_host $server_host -server_port $port" run_singbox flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args} ;; xray) @@ -602,6 +603,7 @@ run_socks() { config_file=$(echo $config_file | sed "s/SOCKS/HTTP_SOCKS/g") local _args="http_port=$http_port" } + [ -n "$relay_port" ] && _args="${_args} -server_host $server_host -server_port $port" run_xray flag=$flag node=$node socks_port=$socks_port config_file=$config_file log_file=$log_file ${_args} ;; trojan-go) diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index b0d879f22..cad9894ca 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -398,7 +398,12 @@ local function processData(szType, content, add_mode, add_from) result.remarks = info.ps -- result.mux = 1 -- result.mux_concurrency = 8 + + if not info.net then + info.net = "tcp" + end info.net = string.lower(info.net) + result.transport = info.net if info.net == 'ws' then result.ws_host = info.host result.ws_path = info.path @@ -434,7 +439,6 @@ local function processData(szType, content, add_mode, add_from) if info.net == 'grpc' then result.grpc_serviceName = info.path end - result.transport = info.net if not info.security then result.security = "auto" end if info.tls == "tls" or info.tls == "1" then result.tls = "1" @@ -757,7 +761,11 @@ local function processData(szType, content, add_mode, add_from) result.address = host_port end + if not params.type then + params.type = "tcp" + end params.type = string.lower(params.type) + result.transport = params.type if params.type == 'ws' then result.ws_host = params.host result.ws_path = params.path @@ -793,7 +801,6 @@ local function processData(szType, content, add_mode, add_from) if params.serviceName then result.grpc_serviceName = params.serviceName end result.grpc_mode = params.mode end - result.transport = params.type result.encryption = params.encryption or "none" diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua index 786d1cddc..afd7c59f2 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -611,4 +611,18 @@ if singbox_tags:find("with_utls") then o:depends({ [option_name("shadowtls")] = true, [option_name("shadowtls_utls")] = true }) end +-- [[ SIP003 plugin ]]-- +o = s:option(Flag, option_name("plugin_enabled"), translate("plugin")) +o.default = 0 +o:depends({ [option_name("protocol")] = "shadowsocks" }) + +o = s:option(ListValue, option_name("plugin"), "SIP003 " .. translate("plugin")) +o.default = "obfs-local" +o:depends({ [option_name("plugin_enabled")] = true }) +o:value("obfs-local") +o:value("v2ray-plugin") + +o = s:option(Value, option_name("plugin_opts"), translate("opts")) +o:depends({ [option_name("plugin_enabled")] = true }) + api.luci_types(arg[1], m, s, type_name, option_prefix) diff --git a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 76cbafc5a..0182d7141 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -205,8 +205,8 @@ function gen_outbound(flag, node, tag, proxy_table) protocol_table = { method = node.method or nil, password = node.password or "", - plugin = node.plugin and nil, - plugin_opts = node.plugin_opts and nil, + plugin = (node.plugin_enabled and node.plugin) or nil, + plugin_opts = (node.plugin_enabled and node.plugin_opts) or nil, udp_over_tcp = node.uot == "1" and { enabled = true, version = 2