From 895cb86141612d9e3e00070504faf8cd5889f25e Mon Sep 17 00:00:00 2001 From: actions Date: Thu, 2 May 2024 14:30:05 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/87c3d9b83098f5eca329ac0a234ad242ae67d966 --- .../model/cbi/passwall/client/other.lua | 35 ++++++------------- .../luasrc/passwall/util_xray.lua | 6 ++-- luci-app-passwall/po/zh-cn/passwall.po | 14 +++----- patch-luci-app-passwall.patch | 2 +- 4 files changed, 19 insertions(+), 38 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index 2068b06de..04b70f30f 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -174,32 +174,19 @@ if has_xray then o.default = "10-20" o:depends("fragment", true) - o = s_xray:option(Flag, "sniffing", translate("Sniffing"), translate("When using the shunt, this option will be forced to be enabled.")) - o.default = 1 - o.rmempty = false + o = s_xray:option(Flag, "sniffing_override_dest", translate("Override the connection destination address"), translate("Override the connection destination address with the sniffed domain.")) + o.default = 0 - if has_xray then - o = s_xray:option(Flag, "route_only", translate("Sniffing Route Only")) - o.default = 0 - o:depends("sniffing", true) + local domains_excluded = string.format("/usr/share/%s/rules/domains_excluded", appname) + o = s_xray:option(TextValue, "excluded_domains", translate("Excluded Domains"), translate("If the traffic sniffing result is in this list, the destination address will not be overridden.")) + o.rows = 15 + o.wrap = "off" + o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end + o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end + o:depends({sniffing_override_dest = true}) - local domains_excluded = string.format("/usr/share/%s/rules/domains_excluded", appname) - o = s_xray:option(TextValue, "no_sniffing_hosts", translate("No Sniffing Lists"), translate("Hosts added into No Sniffing Lists will not resolve again on server.")) - o.rows = 15 - o.wrap = "off" - o.cfgvalue = function(self, section) return fs.readfile(domains_excluded) or "" end - o.write = function(self, section, value) fs.writefile(domains_excluded, value:gsub("\r\n", "\n")) end - o.remove = function(self, section) - local route_only_value = s_xray.fields["route_only"] and s_xray.fields["route_only"]:formvalue(section) or nil - if not route_only_value or route_only_value == "0" then - fs.writefile(domains_excluded, "") - end - end - o:depends({sniffing = true, route_only = false}) - - o = s_xray:option(Value, "buffer_size", translate("Buffer Size"), translate("Buffer size for every connection (kB)")) - o.datatype = "uinteger" - end + o = s_xray:option(Value, "buffer_size", translate("Buffer Size"), translate("Buffer size for every connection (kB)")) + o.datatype = "uinteger" end if has_singbox then diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 2dc128237..b579b40b4 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -616,11 +616,11 @@ function gen_config(var) settings = {network = "tcp,udp", followRedirect = true}, streamSettings = {sockopt = {tproxy = "tproxy"}}, sniffing = { - enabled = xray_settings.sniffing == "1" or node.protocol == "_shunt", + enabled = xray_settings.sniffing_override_dest == "1" or node.protocol == "_shunt", destOverride = {"http", "tls", "quic"}, metadataOnly = false, - routeOnly = (xray_settings.sniffing == "1" and xray_settings.route_only == "1") or (xray_settings.sniffing == "0" and node.protocol == "_shunt"), - domainsExcluded = (xray_settings.sniffing == "1" and xray_settings.route_only == "0") and get_domain_excluded() or nil + routeOnly = node.protocol == "_shunt" and xray_settings.sniffing_override_dest ~= "1" or nil, + domainsExcluded = xray_settings.sniffing_override_dest == "1" and get_domain_excluded() or nil } } diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index b201e4526..11e0f5c34 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -691,12 +691,6 @@ msgstr "劫持ICMPv6 (IPv6 PING)" msgid "Sniffing" msgstr "流量嗅探" -msgid "When using the shunt, this option will be forced to be enabled." -msgstr "使用分流时,将强制启用此选项。" - -msgid "Sniffing Route Only" -msgstr "流量嗅探仅供路由使用" - msgid "TCP Proxy Way" msgstr "TCP 代理方式" @@ -1501,11 +1495,11 @@ msgstr "无子连接时的健康检查" msgid "Initial Windows Size" msgstr "初始窗口大小" -msgid "No Sniffing Lists" -msgstr "不进行流量嗅探的域名列表" +msgid "Excluded Domains" +msgstr "排除域名" -msgid "Hosts added into No Sniffing Lists will not resolve again on server." -msgstr "加入的域名不会再次在服务器解析。" +msgid "If the traffic sniffing result is in this list, the destination address will not be overridden." +msgstr "如果流量嗅探结果在此列表中,则不会覆盖目标地址。" msgid "Buffer Size" msgstr "缓冲区大小" diff --git a/patch-luci-app-passwall.patch b/patch-luci-app-passwall.patch index 2c43eb9bd..4b5b64c00 100644 --- a/patch-luci-app-passwall.patch +++ b/patch-luci-app-passwall.patch @@ -145,7 +145,7 @@ index 55bb691..e13625a 100644 s = m:section(NamedSection, arg[1]) s.addremove = false diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua -index 4dd6967..2068b06 100644 +index 72997c3..04b70f3 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -11,7 +11,6 @@ local port_validate = function(self, value, t)