From 76bbeab78c1b5f6f316bc339b18962b9ed28971a Mon Sep 17 00:00:00 2001 From: actions-user Date: Thu, 2 May 2024 16:13:39 +0800 Subject: [PATCH] update 2024-05-02 16:13:39 --- .../model/cbi/passwall/client/other.lua | 35 ++++++------------- .../luasrc/passwall/util_xray.lua | 6 ++-- luci-app-passwall/po/zh-cn/passwall.po | 14 +++----- 3 files changed, 18 insertions(+), 37 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 4dd6967e08..72997c3442 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -175,32 +175,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, "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}) + 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}) - 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 2dc1282370..b579b40b44 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 b201e45266..11e0f5c347 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 "缓冲区大小"