Skip to content

Commit

Permalink
update 2024-05-02 16:13:39
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzok8 committed May 2, 2024
1 parent 67d3801 commit 76bbeab
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 37 deletions.
35 changes: 11 additions & 24 deletions luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions luci-app-passwall/luasrc/passwall/util_xray.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

Expand Down
14 changes: 4 additions & 10 deletions luci-app-passwall/po/zh-cn/passwall.po
Original file line number Diff line number Diff line change
Expand Up @@ -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 代理方式"

Expand Down Expand Up @@ -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 "缓冲区大小"
Expand Down

0 comments on commit 76bbeab

Please sign in to comment.