parent
a58776adf8
commit
c8dcd434f1
@ -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,7 +1204,9 @@ function gen_config(var)
|
|||||||
_direct_dns.address = "tcp://" .. direct_dns_tcp_server .. ":" .. port
|
_direct_dns.address = "tcp://" .. direct_dns_tcp_server .. ":" .. port
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(dns.servers, _direct_dns)
|
if COMMON.default_outbound_tag == "direct" then
|
||||||
|
table.insert(dns.servers, _direct_dns)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local _remote_dns = {
|
local _remote_dns = {
|
||||||
@ -1318,13 +1318,15 @@ function gen_config(var)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
if direct_dns_udp_server or direct_dns_tcp_server then
|
if COMMON.default_outbound_tag == "direct" then
|
||||||
table.insert(routing.rules, {
|
if direct_dns_udp_server or direct_dns_tcp_server then
|
||||||
inboundTag = {
|
table.insert(routing.rules, {
|
||||||
"dns-global-direct"
|
inboundTag = {
|
||||||
},
|
"dns-global-direct"
|
||||||
outboundTag = "direct"
|
},
|
||||||
})
|
outboundTag = "direct"
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--按分流顺序DNS
|
--按分流顺序DNS
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user