luci-app-passwall: sync upstream

last commit: a031359a96
This commit is contained in:
gitea-action 2025-04-02 17:00:22 +08:00
parent a58776adf8
commit c8dcd434f1

View File

@ -1158,8 +1158,6 @@ function gen_config(var)
end end
if remote_dns_tcp_server and remote_dns_tcp_port then if remote_dns_tcp_server and remote_dns_tcp_port then
local rules = {}
if not routing then if not routing then
routing = { routing = {
domainStrategy = "IPOnDemand", domainStrategy = "IPOnDemand",
@ -1206,8 +1204,10 @@ function gen_config(var)
_direct_dns.address = "tcp://" .. direct_dns_tcp_server .. ":" .. port _direct_dns.address = "tcp://" .. direct_dns_tcp_server .. ":" .. port
end end
if COMMON.default_outbound_tag == "direct" then
table.insert(dns.servers, _direct_dns) table.insert(dns.servers, _direct_dns)
end end
end
local _remote_dns = { local _remote_dns = {
--tag = "dns-global-remote", --tag = "dns-global-remote",
@ -1318,6 +1318,7 @@ function gen_config(var)
}) })
end end
if COMMON.default_outbound_tag == "direct" then
if direct_dns_udp_server or direct_dns_tcp_server then if direct_dns_udp_server or direct_dns_tcp_server then
table.insert(routing.rules, { table.insert(routing.rules, {
inboundTag = { inboundTag = {
@ -1326,6 +1327,7 @@ function gen_config(var)
outboundTag = "direct" outboundTag = "direct"
}) })
end end
end
--按分流顺序DNS --按分流顺序DNS
if dns_domain_rules and #dns_domain_rules > 0 then if dns_domain_rules and #dns_domain_rules > 0 then
@ -1368,16 +1370,17 @@ function gen_config(var)
outboundTag = dns_outbound_tag outboundTag = dns_outbound_tag
}) })
local default_rule_index = #routing.rules > 0 and #routing.rules or 1 local default_rule_index = nil
for index, value in ipairs(routing.rules) do for index, value in ipairs(routing.rules) do
if value.ruleTag == "default" then if value.ruleTag == "default" then
default_rule_index = index default_rule_index = index
break break
end end
end end
for index, value in ipairs(rules) do if default_rule_index then
local t = rules[#rules + 1 - index] local default_rule = api.clone(routing.rules[default_rule_index])
table.insert(routing.rules, default_rule_index, t) table.remove(routing.rules, default_rule_index)
table.insert(routing.rules, default_rule)
end end
local dns_hosts_len = 0 local dns_hosts_len = 0