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