mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-07-31 23:01:21 +08:00
🎁 Sync 2026-04-09 04:39:26
This commit is contained in:
parent
a9bf61bd5e
commit
a4e69b8f7b
@ -566,7 +566,7 @@ o = s:taboption("DNS", DynamicList, "ad_url", translate("Anti-AD Rules Subscribe
|
||||
o:value("https://cdn.jsdelivr.net/gh/217heidai/adblockfilters@main/rules/adblockdomainlite.txt", translate("AdBlock DNS Filters"))
|
||||
o:value("https://cdn.jsdelivr.net/gh/privacy-protection-tools/anti-AD/anti-ad-domains.txt", translate("anti-AD"))
|
||||
o.default = "https://cdn.jsdelivr.net/gh/217heidai/adblockfilters@main/rules/adblockdomainlite.txt"
|
||||
o.description = translate("Support Domain / Dnsmasq / Hosts format list")
|
||||
o.description = translate("Support Domain / Dnsmasq / AdGuardHome / Hosts format list")
|
||||
o:depends("adblock",1)
|
||||
|
||||
s:tab("Proxy", translate("Mode"))
|
||||
|
||||
@ -31,8 +31,8 @@ msgstr "上一次规则更新时间"
|
||||
msgid "Subscribe Rules Data"
|
||||
msgstr "去广告规则"
|
||||
|
||||
msgid "Support Domain / Dnsmasq / Hosts format list"
|
||||
msgstr "支持 域名/Dnsmasq/Hosts 格式的过滤列表"
|
||||
msgid "Support Domain / Dnsmasq / AdGuardHome / Hosts format list"
|
||||
msgstr "支持 域名/Dnsmasq/AdGuardHome/Hosts 格式的过滤列表"
|
||||
|
||||
msgid "Anti-AD Rules Subscribe"
|
||||
msgstr "广告过滤列表URL"
|
||||
|
||||
@ -60,7 +60,7 @@ process_url() {
|
||||
if (fmt == "" && $0 ~ /^\|\|[a-zA-Z0-9]/) fmt = "adguard"
|
||||
if (fmt == "" && $0 ~ /^(0\.0\.0\.0|127\.0\.0\.1)[[:space:]]/)
|
||||
fmt = "hosts"
|
||||
if (fmt == "" && $0 ~ /^[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9\-]*[a-zA-Z0-9])?)+$/)
|
||||
if (fmt == "" && $0 ~ /^[a-zA-Z0-9]([a-zA-Z0-9.\-]*[a-zA-Z0-9])?\.[a-zA-Z]{2,}$/)
|
||||
fmt = "plain"
|
||||
}
|
||||
|
||||
|
||||
@ -722,6 +722,7 @@ o = s:option(ListValue, _n("domain_resolver"), translate("Domain DNS Resolve"),
|
||||
o:value("", translate("Auto"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:value("https", "HTTPS")
|
||||
|
||||
o = s:option(Value, _n("domain_resolver_dns"), "DNS")
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
@ -731,6 +732,12 @@ o.default = o.keylist[1]
|
||||
o:depends({ [_n("domain_resolver")] = "tcp" })
|
||||
o:depends({ [_n("domain_resolver")] = "udp" })
|
||||
|
||||
o = s:option(Value, _n("domain_resolver_dns_https"), "DNS")
|
||||
o:value("https://120.53.53.53/dns-query", "DNSPod")
|
||||
o:value("https://223.5.5.5/dns-query", "AliDNS")
|
||||
o.default = o.keylist[1]
|
||||
o:depends({ [_n("domain_resolver")] = "https" })
|
||||
|
||||
o = s:option(ListValue, _n("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect."))
|
||||
o.default = ""
|
||||
o:value("", translate("Auto"))
|
||||
|
||||
@ -780,6 +780,7 @@ o = s:option(ListValue, _n("domain_resolver"), translate("Domain DNS Resolve"),
|
||||
o:value("", translate("Auto"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:value("https", "HTTPS")
|
||||
|
||||
o = s:option(Value, _n("domain_resolver_dns"), "DNS")
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
@ -789,6 +790,12 @@ o.default = o.keylist[1]
|
||||
o:depends({ [_n("domain_resolver")] = "tcp" })
|
||||
o:depends({ [_n("domain_resolver")] = "udp" })
|
||||
|
||||
o = s:option(Value, _n("domain_resolver_dns_https"), "DNS")
|
||||
o:value("https://120.53.53.53/dns-query", "DNSPod")
|
||||
o:value("https://223.5.5.5/dns-query", "AliDNS")
|
||||
o.default = o.keylist[1]
|
||||
o:depends({ [_n("domain_resolver")] = "https" })
|
||||
|
||||
o = s:option(ListValue, _n("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect."))
|
||||
o.default = ""
|
||||
o:value("", translate("Auto"))
|
||||
|
||||
@ -163,15 +163,31 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
detour = node.detour,
|
||||
}
|
||||
|
||||
if api.datatypes.hostname(node.address) and (node.domain_resolver == "tcp" or node.domain_resolver == "udp") and node.domain_resolver_dns then
|
||||
if api.datatypes.hostname(node.address) and node.domain_resolver and (node.domain_resolver_dns or node.domain_resolver_dns_https) then
|
||||
local dns_tag = node_id .. "_dns"
|
||||
local dns_proto = node.domain_resolver
|
||||
local server_address = node.domain_resolver_dns
|
||||
local server_port = 53
|
||||
local split = api.split(server_address, ":")
|
||||
if #split > 1 then
|
||||
server_address = split[1]
|
||||
server_port = tonumber(split[#split])
|
||||
local server_address
|
||||
local server_port
|
||||
local server_path
|
||||
if dns_proto == "https" then
|
||||
local _a = api.parseURL(node.domain_resolver_dns_https)
|
||||
if _a then
|
||||
server_address = _a.hostname
|
||||
if _a.port then
|
||||
server_port = _a.port
|
||||
else
|
||||
server_port = 443
|
||||
end
|
||||
server_path = _a.pathname
|
||||
end
|
||||
else
|
||||
server_address = node.domain_resolver_dns
|
||||
server_port = 53
|
||||
local split = api.split(server_address, ":")
|
||||
if #split > 1 then
|
||||
server_address = split[1]
|
||||
server_port = tonumber(split[#split])
|
||||
end
|
||||
end
|
||||
GLOBAL.DNS_SERVER[node_id] = {
|
||||
server = {
|
||||
@ -179,6 +195,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
type = dns_proto,
|
||||
server = server_address,
|
||||
server_port = server_port,
|
||||
path = server_path,
|
||||
domain_resolver = "local",
|
||||
detour = "direct"
|
||||
},
|
||||
domain = node.address
|
||||
|
||||
@ -399,25 +399,39 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
end
|
||||
end
|
||||
|
||||
if api.datatypes.hostname(node.address) and (node.domain_resolver == "tcp" or node.domain_resolver == "udp") and node.domain_resolver_dns then
|
||||
if api.datatypes.hostname(node.address) and node.domain_resolver and (node.domain_resolver_dns or node.domain_resolver_dns_https) then
|
||||
local dns_tag = node_id .. "_dns"
|
||||
local dns_proto = node.domain_resolver
|
||||
local server_address = node.domain_resolver_dns
|
||||
local server_port = 53
|
||||
local split = api.split(server_address, ":")
|
||||
if #split > 1 then
|
||||
server_address = split[1]
|
||||
server_port = tonumber(split[#split])
|
||||
end
|
||||
local config_address = server_address
|
||||
if dns_proto == "tcp" then
|
||||
config_address = dns_proto .. "://" .. server_address .. ":" .. server_port
|
||||
local config_address
|
||||
local config_port
|
||||
if dns_proto == "https" then
|
||||
local _a = api.parseURL(node.domain_resolver_dns_https)
|
||||
if _a then
|
||||
config_address = node.domain_resolver_dns_https
|
||||
if _a.port then
|
||||
config_port = _a.port
|
||||
else
|
||||
config_port = 443
|
||||
end
|
||||
end
|
||||
else
|
||||
local server_address = node.domain_resolver_dns
|
||||
local config_port = 53
|
||||
local split = api.split(server_address, ":")
|
||||
if #split > 1 then
|
||||
server_address = split[1]
|
||||
config_port = tonumber(split[#split])
|
||||
end
|
||||
config_address = server_address
|
||||
if dns_proto == "tcp" then
|
||||
config_address = dns_proto .. "://" .. server_address .. ":" .. config_port
|
||||
end
|
||||
end
|
||||
GLOBAL.DNS_SERVER[node_id] = {
|
||||
tag = dns_tag,
|
||||
queryStrategy = node.domain_strategy or "UseIP",
|
||||
address = config_address,
|
||||
port = server_port,
|
||||
port = config_port,
|
||||
domains = {"full:" .. node.address}
|
||||
}
|
||||
end
|
||||
@ -1674,7 +1688,6 @@ function gen_config(var)
|
||||
dns_server = nil
|
||||
end
|
||||
if dns_server then
|
||||
dns_server.finalQuery = true
|
||||
dns_server.domains = value.domain
|
||||
if value.shunt_rule_name then
|
||||
dns_server.tag = "dns-in-" .. value.shunt_rule_name
|
||||
|
||||
Loading…
Reference in New Issue
Block a user