mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-16 21:43:33 +08:00
🎨 Sync 2026-04-10 15:34:26
This commit is contained in:
1 parent
9b1a57d792
commit
42174fc0b0
66 files changed
+6841
-2210
No files matched your search
@@ -120,14 +120,6 @@ if #ss_type > 0 or #trojan_type > 0 or #vmess_type > 0 or #vless_type > 0 or #hy
|
||||
translate("The configured type also applies to the core specified when manually importing nodes."))
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node."))
|
||||
o.default = ""
|
||||
o:value("", translate("Auto"))
|
||||
o:value("prefer_ipv4", translate("Prefer IPv4"))
|
||||
o:value("prefer_ipv6", translate("Prefer IPv6"))
|
||||
o:value("ipv4_only", translate("IPv4 Only"))
|
||||
o:value("ipv6_only", translate("IPv6 Only"))
|
||||
|
||||
---- Subscribe Delete All
|
||||
o = s:option(DummyValue, "_stop", translate("Delete All Subscribe Node"))
|
||||
o.rawhtml = true
|
||||
|
||||
@@ -133,6 +133,35 @@ o.validate = function(self, value)
|
||||
return value:gsub("%s+", ""):gsub("%z", "")
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "domain_resolver", translate("Domain DNS Resolve"))
|
||||
o.description = translate("If the node address is a domain name, this DNS will be used for resolution.") .. "<br>" ..
|
||||
translate("Supports only Xray or Sing-box node types.") .. "<br>" .. string.format('<font color="red">%s</font>',
|
||||
translate("Note: For node-specific DNS only. Keep Auto to avoid extra overhead."))
|
||||
o:value("", translate("Auto"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:value("https", "DoH")
|
||||
|
||||
o = s:option(Value, "domain_resolver_dns", "DNS")
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
o:value("114.114.114.114")
|
||||
o:value("223.5.5.5:53")
|
||||
o.default = o.keylist[1]
|
||||
o:depends({ domain_resolver = "tcp" })
|
||||
o:depends({ domain_resolver = "udp" })
|
||||
|
||||
o = s:option(Value, "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({ domain_resolver = "https" })
|
||||
|
||||
o = s:option(ListValue, "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"))
|
||||
o:value("UseIPv4", translate("IPv4 Only"))
|
||||
o:value("UseIPv6", translate("IPv6 Only"))
|
||||
|
||||
o = s:option(Flag, "allowInsecure", translate("allowInsecure"))
|
||||
o.default = "1"
|
||||
o.rmempty = false
|
||||
@@ -203,15 +232,6 @@ if #hysteria2_type > 0 then
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node."))
|
||||
o.default = "global"
|
||||
o:value("global", translate("Use global config"))
|
||||
o:value("", translate("Auto"))
|
||||
o:value("prefer_ipv4", translate("Prefer IPv4"))
|
||||
o:value("prefer_ipv6", translate("Prefer IPv6"))
|
||||
o:value("ipv4_only", translate("IPv4 Only"))
|
||||
o:value("ipv6_only", translate("IPv6 Only"))
|
||||
|
||||
o = s:option(Flag, "boot_update", translate("Update Once on Boot"), translate("Updates the subscription the first time PassWall runs automatically after each system boot."))
|
||||
o.default = 0
|
||||
|
||||
|
||||
@@ -240,16 +240,6 @@ o = s:option(Value, _n("address"), translate("Address (Support Domain Name)"))
|
||||
o = s:option(Value, _n("port"), translate("Port"))
|
||||
o.datatype = "port"
|
||||
|
||||
local protocols = s.fields[_n("protocol")].keylist
|
||||
if #protocols > 0 then
|
||||
for index, value in ipairs(protocols) do
|
||||
if not value:find("^_") then
|
||||
s.fields[_n("address")]:depends({ [_n("protocol")] = value })
|
||||
s.fields[_n("port")]:depends({ [_n("protocol")] = value })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(Value, _n("uuid"), translate("ID"))
|
||||
o.password = true
|
||||
o:depends({ [_n("protocol")] = "vmess" })
|
||||
@@ -735,10 +725,48 @@ o.datatype = "uinteger"
|
||||
o.placeholder = 0
|
||||
o:depends({ [_n("protocol")] = "vless" })
|
||||
|
||||
for i, v in ipairs(s.fields[_n("protocol")].keylist) do
|
||||
if not v:find("^_") and v ~= "hysteria2" then
|
||||
s.fields[_n("tcp_fast_open")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("tcpMptcp")]:depends({ [_n("protocol")] = v })
|
||||
o = s:option(ListValue, _n("domain_resolver"), translate("Domain DNS Resolve"))
|
||||
o.description = translate("If the node address is a domain name, this DNS will be used for resolution.") .. "<br>" .. string.format('<font color="red">%s</font>',
|
||||
translate("Note: For node-specific DNS only. Keep Auto to avoid extra overhead."))
|
||||
o:value("", translate("Auto"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:value("https", "DoH")
|
||||
|
||||
o = s:option(Value, _n("domain_resolver_dns"), "DNS")
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
o:value("114.114.114.114")
|
||||
o:value("223.5.5.5:53")
|
||||
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"))
|
||||
o:value("UseIPv4", translate("IPv4 Only"))
|
||||
o:value("UseIPv6", translate("IPv6 Only"))
|
||||
|
||||
local protocols = s.fields[_n("protocol")].keylist
|
||||
if #protocols > 0 then
|
||||
for i, v in ipairs(protocols) do
|
||||
if not v:find("^_") then
|
||||
s.fields[_n("address")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("port")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("domain_resolver")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("domain_strategy")]:depends({ [_n("protocol")] = v })
|
||||
|
||||
if v ~= "hysteria2" then
|
||||
s.fields[_n("tcp_fast_open")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("tcpMptcp")]:depends({ [_n("protocol")] = v })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -206,16 +206,6 @@ o = s:option(Value, _n("address"), translate("Address (Support Domain Name)"))
|
||||
o = s:option(Value, _n("port"), translate("Port"))
|
||||
o.datatype = "port"
|
||||
|
||||
local protocols = s.fields[_n("protocol")].keylist
|
||||
if #protocols > 0 then
|
||||
for index, value in ipairs(protocols) do
|
||||
if not value:find("^_") then
|
||||
s.fields[_n("address")]:depends({ [_n("protocol")] = value })
|
||||
s.fields[_n("port")]:depends({ [_n("protocol")] = value })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(Value, _n("uuid"), translate("ID"))
|
||||
o.password = true
|
||||
o:depends({ [_n("protocol")] = "vmess" })
|
||||
@@ -742,6 +732,28 @@ o:value("v2ray-plugin")
|
||||
o = s:option(Value, _n("plugin_opts"), translate("opts"))
|
||||
o:depends({ [_n("plugin_enabled")] = true })
|
||||
|
||||
o = s:option(ListValue, _n("domain_resolver"), translate("Domain DNS Resolve"))
|
||||
o.description = translate("If the node address is a domain name, this DNS will be used for resolution.") .. "<br>" .. string.format('<font color="red">%s</font>',
|
||||
translate("Note: For node-specific DNS only. Keep Auto to avoid extra overhead."))
|
||||
o:value("", translate("Auto"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("udp", "UDP")
|
||||
o:value("https", "DoH")
|
||||
|
||||
o = s:option(Value, _n("domain_resolver_dns"), "DNS")
|
||||
o.datatype = "or(ipaddr,ipaddrport)"
|
||||
o:value("114.114.114.114")
|
||||
o:value("223.5.5.5:53")
|
||||
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"))
|
||||
@@ -749,17 +761,19 @@ o:value("prefer_ipv4", translate("Prefer IPv4"))
|
||||
o:value("prefer_ipv6", translate("Prefer IPv6"))
|
||||
o:value("ipv4_only", translate("IPv4 Only"))
|
||||
o:value("ipv6_only", translate("IPv6 Only"))
|
||||
o:depends({ [_n("protocol")] = "socks" })
|
||||
o:depends({ [_n("protocol")] = "http" })
|
||||
o:depends({ [_n("protocol")] = "shadowsocks" })
|
||||
o:depends({ [_n("protocol")] = "vmess" })
|
||||
o:depends({ [_n("protocol")] = "trojan" })
|
||||
o:depends({ [_n("protocol")] = "wireguard" })
|
||||
o:depends({ [_n("protocol")] = "hysteria" })
|
||||
o:depends({ [_n("protocol")] = "vless" })
|
||||
o:depends({ [_n("protocol")] = "tuic" })
|
||||
o:depends({ [_n("protocol")] = "hysteria2" })
|
||||
o:depends({ [_n("protocol")] = "anytls" })
|
||||
|
||||
|
||||
local protocols = s.fields[_n("protocol")].keylist
|
||||
if #protocols > 0 then
|
||||
for i, v in ipairs(protocols) do
|
||||
if not v:find("^_") then
|
||||
s.fields[_n("address")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("port")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("domain_resolver")]:depends({ [_n("protocol")] = v })
|
||||
s.fields[_n("domain_strategy")]:depends({ [_n("protocol")] = v })
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
-- [[ Normal single node End ]]
|
||||
|
||||
|
||||
@@ -11,6 +11,10 @@ local ech_domain = {}
|
||||
local local_version = api.get_app_version("sing-box"):match("[^v]+")
|
||||
local version_ge_1_13_0 = api.compare_versions(local_version, ">=", "1.13.0")
|
||||
|
||||
local GLOBAL = {
|
||||
DNS_SERVER = {}
|
||||
}
|
||||
|
||||
local GEO_VAR = {
|
||||
OK = nil,
|
||||
DIR = nil,
|
||||
@@ -154,6 +158,47 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
detour = node.detour,
|
||||
}
|
||||
|
||||
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
|
||||
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 = {
|
||||
tag = dns_tag,
|
||||
type = dns_proto,
|
||||
server = server_address,
|
||||
server_port = server_port,
|
||||
path = server_path,
|
||||
domain_resolver = "direct",
|
||||
detour = "direct"
|
||||
},
|
||||
domain = node.address
|
||||
}
|
||||
result.domain_resolver.server = dns_tag
|
||||
end
|
||||
|
||||
local tls = nil
|
||||
if node.protocol == "hysteria" or node.protocol == "hysteria2" or node.protocol == "tuic" or node.protocol == "naive" then
|
||||
node.tls = "1"
|
||||
@@ -1922,6 +1967,16 @@ function gen_config(var)
|
||||
}
|
||||
end
|
||||
|
||||
for i, v in pairs(GLOBAL.DNS_SERVER) do
|
||||
table.insert(dns.servers, v.server)
|
||||
if not dns.rules then dns.rules = {} end
|
||||
table.insert(dns.rules, {
|
||||
action = "route",
|
||||
server = v.server.tag,
|
||||
domain = v.domain,
|
||||
})
|
||||
end
|
||||
|
||||
if next(ech_domain) ~= nil then
|
||||
table.insert(dns.servers, {
|
||||
tag = "ech-dns",
|
||||
@@ -1983,6 +2038,12 @@ function gen_config(var)
|
||||
if not value["_flag_proxy_tag"] and not value.detour and value["_id"] and value.server and (value.server_port or value.server_ports) and not no_run then
|
||||
sys.call(string.format("echo '%s' >> %s", value["_id"], api.TMP_PATH .. "/direct_node_list"))
|
||||
end
|
||||
if not value.detour and value.server then
|
||||
value.detour = "direct"
|
||||
end
|
||||
if value.server and not api.datatypes.hostname(value.server) then
|
||||
value.domain_resolver = nil
|
||||
end
|
||||
for k, v in pairs(config.outbounds[index]) do
|
||||
if k:find("_") == 1 then
|
||||
config.outbounds[index][k] = nil
|
||||
|
||||
@@ -6,6 +6,11 @@ local jsonc = api.jsonc
|
||||
local appname = "passwall"
|
||||
local fs = api.fs
|
||||
|
||||
local GLOBAL = {
|
||||
DNS_SERVER = {},
|
||||
DNS_HOSTNAME = {}
|
||||
}
|
||||
|
||||
local xray_version = api.get_app_version("xray")
|
||||
|
||||
local function get_domain_excluded()
|
||||
@@ -134,6 +139,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
streamSettings = (node.streamSettings or node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan" or node.protocol == "hysteria") and {
|
||||
sockopt = {
|
||||
mark = 255,
|
||||
domainStrategy = node.domain_strategy or "UseIP",
|
||||
tcpFastOpen = (node.tcp_fast_open == "1") and true or nil,
|
||||
tcpMptcp = (node.tcpMptcp == "1") and true or nil
|
||||
},
|
||||
@@ -397,6 +403,48 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
result.streamSettings.tlsSettings.alpn = alpn
|
||||
end
|
||||
end
|
||||
|
||||
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 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
|
||||
if _a.hostname then
|
||||
if api.datatypes.hostname(_a.hostname) then
|
||||
GLOBAL.DNS_HOSTNAME[_a.hostname] = true
|
||||
end
|
||||
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 = config_port,
|
||||
domains = {"full:" .. node.address}
|
||||
}
|
||||
end
|
||||
end
|
||||
return result
|
||||
end
|
||||
@@ -1437,7 +1485,15 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
|
||||
if (remote_dns_udp_server and remote_dns_udp_port) or (remote_dns_tcp_server and remote_dns_tcp_port) then
|
||||
local node_dns = {}
|
||||
for i, v in pairs(GLOBAL.DNS_SERVER) do
|
||||
table.insert(node_dns, {
|
||||
server = v,
|
||||
outboundTag = "direct"
|
||||
})
|
||||
end
|
||||
|
||||
if (remote_dns_udp_server and remote_dns_udp_port) or (remote_dns_tcp_server and remote_dns_tcp_port) or #node_dns > 0 then
|
||||
if not routing then
|
||||
routing = {
|
||||
domainStrategy = "IPOnDemand",
|
||||
@@ -1461,6 +1517,8 @@ function gen_config(var)
|
||||
queryStrategy = (direct_dns_query_strategy and direct_dns_query_strategy ~= "") and direct_dns_query_strategy or "UseIP"
|
||||
}
|
||||
|
||||
direct_dns_udp_server = (direct_dns_udp_server and direct_dns_udp_server ~= "") and direct_dns_udp_server or nil
|
||||
|
||||
if direct_dns_udp_server or direct_dns_tcp_server then
|
||||
local domain = {}
|
||||
local nodes_domain_text = sys.exec('uci show passwall | grep ".address=" | cut -d "\'" -f 2 | grep "[a-zA-Z]$" | sort -u')
|
||||
@@ -1489,14 +1547,12 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
|
||||
local _remote_dns = {
|
||||
--tag = "dns-global-remote",
|
||||
queryStrategy = (remote_dns_query_strategy and remote_dns_query_strategy ~= "") and remote_dns_query_strategy or "UseIPv4",
|
||||
}
|
||||
local _remote_dns = {}
|
||||
|
||||
if remote_dns_udp_server then
|
||||
_remote_dns.address = remote_dns_udp_server
|
||||
_remote_dns.port = tonumber(remote_dns_udp_port) or 53
|
||||
else
|
||||
elseif remote_dns_tcp_server then
|
||||
_remote_dns.address = "tcp://" .. remote_dns_tcp_server .. ":" .. tonumber(remote_dns_tcp_port) or 53
|
||||
end
|
||||
|
||||
@@ -1510,7 +1566,11 @@ function gen_config(var)
|
||||
_remote_dns.port = tonumber(remote_dns_doh_port)
|
||||
end
|
||||
|
||||
table.insert(dns.servers, _remote_dns)
|
||||
if next(_remote_dns) then
|
||||
-- _remote_dns.tag = "dns-global-remote"
|
||||
_remote_dns.queryStrategy = (remote_dns_query_strategy and remote_dns_query_strategy ~= "") and remote_dns_query_strategy or "UseIPv4"
|
||||
table.insert(dns.servers, _remote_dns)
|
||||
end
|
||||
|
||||
local _remote_fakedns = {
|
||||
--tag = "dns-global-remote-fakedns",
|
||||
@@ -1649,7 +1709,7 @@ function gen_config(var)
|
||||
dns_server = nil
|
||||
end
|
||||
if dns_server then
|
||||
dns_server.finalQuery = true
|
||||
--dns_server.finalQuery = true
|
||||
dns_server.domains = value.domain
|
||||
if value.shunt_rule_name then
|
||||
dns_server.tag = "dns-in-" .. value.shunt_rule_name
|
||||
@@ -1666,7 +1726,7 @@ function gen_config(var)
|
||||
end
|
||||
|
||||
local _outboundTag
|
||||
if not api.is_local_ip(_remote_dns.address) or dns_outbound_tag == "blackhole" then --dns为本地ip,不走代理
|
||||
if _remote_dns.address and not api.is_local_ip(_remote_dns.address) or dns_outbound_tag == "blackhole" then --dns为本地ip,不走代理
|
||||
_outboundTag = dns_outbound_tag
|
||||
else
|
||||
_outboundTag = "direct"
|
||||
@@ -1698,6 +1758,37 @@ function gen_config(var)
|
||||
if dns_hosts_len == 0 then
|
||||
dns.hosts = nil
|
||||
end
|
||||
|
||||
-- 自定义节点 DNS
|
||||
if #node_dns > 0 and #dns.servers < 1 then
|
||||
dns.servers = { "localhost" }
|
||||
end
|
||||
for i = #node_dns, 1, -1 do
|
||||
local value = node_dns[i]
|
||||
table.insert(routing.rules, 1, {
|
||||
inboundTag = {
|
||||
value.server.tag
|
||||
},
|
||||
outboundTag = value.outboundTag,
|
||||
})
|
||||
table.insert(dns.servers, 2, value.server)
|
||||
end
|
||||
if next(GLOBAL.DNS_HOSTNAME) then
|
||||
local hostname = {}
|
||||
for line, _ in pairs(GLOBAL.DNS_HOSTNAME) do
|
||||
table.insert(hostname, line)
|
||||
end
|
||||
table.insert(dns.servers, 2, {
|
||||
tag = "bootstrap",
|
||||
address = "223.5.5.5",
|
||||
queryStrategy = "UseIPv4",
|
||||
domains = hostname
|
||||
})
|
||||
table.insert(routing.rules, 1, {
|
||||
inboundTag = { "bootstrap" },
|
||||
outboundTag = "direct"
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if inbounds or outbounds then
|
||||
|
||||
@@ -1972,6 +1972,18 @@ msgstr "延迟(ms)"
|
||||
msgid "If is domain name, The requested domain name will be resolved to IP before connect."
|
||||
msgstr "如果是域名,域名将在请求发出之前解析为 IP。"
|
||||
|
||||
msgid "Domain DNS Resolve"
|
||||
msgstr "域名 DNS 解析"
|
||||
|
||||
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
||||
msgstr "如果节点地址是域名,则将使用此 DNS 进行解析。"
|
||||
|
||||
msgid "Note: For node-specific DNS only. Keep Auto to avoid extra overhead."
|
||||
msgstr "注意:仅用于节点专用 DNS,通常请保持自动,以免增加开销。"
|
||||
|
||||
msgid "Supports only Xray or Sing-box node types."
|
||||
msgstr "仅支持 Xray 或 Sing-box 类型节点。"
|
||||
|
||||
msgid "Chain Proxy"
|
||||
msgstr "链式代理"
|
||||
|
||||
@@ -1985,15 +1997,12 @@ msgid ""
|
||||
"Chained proxy works only with Xray or Sing-box nodes.<br>"
|
||||
"You can only use manual or imported nodes as chained nodes."
|
||||
msgstr ""
|
||||
"链式代理仅支持 Xray 与 Sing-box 节点。<br>"
|
||||
"链式代理仅支持 Xray 或 Sing-box 节点。<br>"
|
||||
"仅支持手动添加或导入的节点用作链式节点。"
|
||||
|
||||
msgid "Only work with using the %s node."
|
||||
msgstr "与使用 %s 节点时生效。"
|
||||
|
||||
msgid "Set the default domain resolution strategy for the sing-box node."
|
||||
msgstr "为 sing-box 节点设置默认的域名解析策略。"
|
||||
|
||||
msgid "Total Lines"
|
||||
msgstr "总行数:"
|
||||
|
||||
|
||||
@@ -186,7 +186,18 @@ run_singbox() {
|
||||
[ -n "$no_run" ] && json_add_string "no_run" "1"
|
||||
local _json_arg="$(json_dump)"
|
||||
lua $UTIL_SINGBOX gen_config "${_json_arg}" > $config_file
|
||||
[ -n "$no_run" ] || ln_run "$SINGBOX_BIN" "sing-box" $log_file run -c "$config_file"
|
||||
[ -n "$no_run" ] && return
|
||||
|
||||
local test_log_file=$log_file
|
||||
[ "$test_log_file" = "/dev/null" ] && test_log_file="${TMP_PATH}/${config_file##*/}_test.log"
|
||||
$SINGBOX_BIN check -c "$config_file" > $test_log_file 2>&1; local status=$?
|
||||
if [ "${status}" = 0 ]; then
|
||||
ln_run "$SINGBOX_BIN" "sing-box" "${log_file}" run -c "$config_file"
|
||||
else
|
||||
echolog "Sing-box 配置文件 $config_file 校验有误,进程启动失败,错误信息:"
|
||||
cat ${test_log_file} >> ${LOG_FILE}
|
||||
fi
|
||||
[ "$test_log_file" != "$log_file" ] && rm -f "${test_log_file}"
|
||||
}
|
||||
|
||||
run_xray() {
|
||||
@@ -275,7 +286,18 @@ run_xray() {
|
||||
[ -n "$no_run" ] && json_add_string "no_run" "1"
|
||||
local _json_arg="$(json_dump)"
|
||||
lua $UTIL_XRAY gen_config "${_json_arg}" > $config_file
|
||||
[ -n "$no_run" ] || ln_run "$XRAY_BIN" "xray" $log_file run -c "$config_file"
|
||||
[ -n "$no_run" ] && return
|
||||
|
||||
local test_log_file=$log_file
|
||||
[ "$test_log_file" = "/dev/null" ] && test_log_file="${TMP_PATH}/${config_file##*/}_test.log"
|
||||
$XRAY_BIN run -test -c "$config_file" > $test_log_file; local status=$?
|
||||
if [ "${status}" = 0 ]; then
|
||||
ln_run "$XRAY_BIN" "xray" "${log_file}" run -c "$config_file"
|
||||
else
|
||||
echolog "Xray 配置文件 $config_file 校验有误,进程启动失败,错误信息:"
|
||||
cat ${test_log_file} >> ${LOG_FILE}
|
||||
fi
|
||||
[ "$test_log_file" != "$log_file" ] && rm -f "${test_log_file}"
|
||||
}
|
||||
|
||||
run_dns2socks() {
|
||||
|
||||
@@ -42,8 +42,7 @@ local core_has = {
|
||||
["trojan-plus"] = has_trojan_plus, ["hysteria2"] = has_hysteria2
|
||||
}
|
||||
----
|
||||
local domain_strategy_default = uci:get(appname, "@global_subscribe[0]", "domain_strategy") or ""
|
||||
local domain_strategy_node = ""
|
||||
local domain_resolver, domain_resolver_dns, domain_resolver_dns_https, domain_strategy
|
||||
local preproxy_node_group, to_node_group, chain_node_type = "", "", ""
|
||||
-- 判断是否过滤节点关键字
|
||||
local filter_keyword_mode_default = uci:get(appname, "@global_subscribe[0]", "filter_keyword_mode") or "0"
|
||||
@@ -1855,9 +1854,22 @@ local function update_node(manual)
|
||||
if kkk ~= "group" or vvv ~= "default" then
|
||||
uci:set(appname, cfgid, kkk, vvv)
|
||||
end
|
||||
-- sing-box 域名解析策略
|
||||
if kkk == "type" and vvv == "sing-box" then
|
||||
uci:set(appname, cfgid, "domain_strategy", domain_strategy_node)
|
||||
-- sing-box/xray 节点域名解析
|
||||
if kkk == "type" and (vvv == "Xray" or vvv == "sing-box") then
|
||||
if domain_resolver then
|
||||
uci:set(appname, cfgid, "domain_resolver", domain_resolver)
|
||||
if domain_resolver_dns then
|
||||
uci:set(appname, cfgid, "domain_resolver_dns", domain_resolver_dns)
|
||||
elseif domain_resolver_dns_https then
|
||||
uci:set(appname, cfgid, "domain_resolver_dns_https", domain_resolver_dns_https)
|
||||
end
|
||||
end
|
||||
if domain_strategy then
|
||||
if vvv == "sing-box" then
|
||||
domain_strategy = (domain_strategy == "UseIPv4" and "ipv4_only") or (domain_strategy == "UseIPv6" and "ipv6_only") or domain_strategy
|
||||
end
|
||||
uci:set(appname, cfgid, "domain_strategy", domain_strategy)
|
||||
end
|
||||
end
|
||||
-- 订阅组链式代理
|
||||
if chain_node_type ~= "" and kkk == "type" and (vvv == "Xray" or vvv == "sing-box") then
|
||||
@@ -2069,12 +2081,11 @@ local execute = function()
|
||||
if hysteria2_type ~= "global" and core_has[hysteria2_type] then
|
||||
hysteria2_type_default = hysteria2_type
|
||||
end
|
||||
local domain_strategy = value.domain_strategy or "global"
|
||||
if domain_strategy ~= "global" then
|
||||
domain_strategy_node = domain_strategy
|
||||
else
|
||||
domain_strategy_node = domain_strategy_default
|
||||
end
|
||||
|
||||
domain_resolver = value.domain_resolver
|
||||
domain_resolver_dns = value.domain_resolver_dns
|
||||
domain_resolver_dns_https = value.domain_resolver_dns_https
|
||||
domain_strategy = (value.domain_strategy == "UseIPv4" or value.domain_strategy == "UseIPv6") and value.domain_strategy or nil
|
||||
|
||||
-- 订阅组链式代理
|
||||
local function valid_chain_node(node)
|
||||
|
||||
Reference in new issue
Block a user