mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 02:23:56 +08:00
✨ Sync 2026-04-11 23:43:05
This commit is contained in:
1 parent
d2ba765237
commit
f4a085b396
14 files changed
+233
-150
No files matched your search
@@ -112,14 +112,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."))
|
translate("The configured type also applies to the core specified when manually importing nodes."))
|
||||||
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 = ""
|
|
||||||
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
|
---- Subscribe Delete All
|
||||||
o = s:option(DummyValue, "_stop", translate("Delete All Subscribe Node"))
|
o = s:option(DummyValue, "_stop", translate("Delete All Subscribe Node"))
|
||||||
o.rawhtml = true
|
o.rawhtml = true
|
||||||
|
|||||||
@@ -127,6 +127,34 @@ o.validate = function(self, value)
|
|||||||
return value:gsub("%s+", ""):gsub("%z", "")
|
return value:gsub("%s+", ""):gsub("%z", "")
|
||||||
end
|
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.")
|
||||||
|
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 = s:option(Flag, "allowInsecure", translate("allowInsecure"))
|
||||||
o.default = "0"
|
o.default = "0"
|
||||||
o.rmempty = false
|
o.rmempty = false
|
||||||
@@ -197,15 +225,6 @@ if #hysteria2_type > 0 then
|
|||||||
end
|
end
|
||||||
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 runs automatically after each system boot."))
|
o = s:option(Flag, "boot_update", translate("Update Once on Boot"), translate("Updates the subscription the first time runs automatically after each system boot."))
|
||||||
o.default = 0
|
o.default = 0
|
||||||
|
|
||||||
|
|||||||
@@ -1094,7 +1094,7 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function parse_rule_set(w, rs)
|
function parse_rule_set(w, rs)
|
||||||
-- Format: remote:https://raw.githubusercontent.com/lyc8503/sing-box-rules/rule-set-geosite/geosite-netflix.srs'
|
-- Format: remote:https://raw.githubusercontent.com/SagerNet/sing-geosite/rule-set/geosite-netflix.srs'
|
||||||
-- Format: local:/usr/share/sing-box/geosite-netflix.srs'
|
-- Format: local:/usr/share/sing-box/geosite-netflix.srs'
|
||||||
local result = nil
|
local result = nil
|
||||||
if w and #w > 0 then
|
if w and #w > 0 then
|
||||||
@@ -1768,7 +1768,25 @@ function gen_config(var)
|
|||||||
reverse_mapping = true, -- After responding to a DNS query, a reverse mapping of the IP address is stored to provide the domain name for routing purposes.
|
reverse_mapping = true, -- After responding to a DNS query, a reverse mapping of the IP address is stored to provide the domain name for routing purposes.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
table.insert(dns.servers, {
|
||||||
|
type = "local",
|
||||||
|
tag = "local"
|
||||||
|
})
|
||||||
|
|
||||||
|
if direct_dns_udp_server then
|
||||||
|
table.insert(dns.servers, {
|
||||||
|
tag = "direct",
|
||||||
|
type = "udp",
|
||||||
|
server = direct_dns_udp_server,
|
||||||
|
server_port = tonumber(direct_dns_udp_port) or 53,
|
||||||
|
detour = "direct",
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
for i, v in pairs(GLOBAL.DNS_SERVER) do
|
for i, v in pairs(GLOBAL.DNS_SERVER) do
|
||||||
|
if direct_dns_udp_server then
|
||||||
|
v.server.domain_resolver = "direct"
|
||||||
|
end
|
||||||
table.insert(dns.servers, v.server)
|
table.insert(dns.servers, v.server)
|
||||||
table.insert(dns.rules, {
|
table.insert(dns.rules, {
|
||||||
action = "route",
|
action = "route",
|
||||||
@@ -1777,11 +1795,6 @@ function gen_config(var)
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(dns.servers, {
|
|
||||||
type = "local",
|
|
||||||
tag = "local"
|
|
||||||
})
|
|
||||||
|
|
||||||
local direct_strategy = "prefer_ipv6"
|
local direct_strategy = "prefer_ipv6"
|
||||||
if direct_dns_query_strategy == "UseIPv4" then
|
if direct_dns_query_strategy == "UseIPv4" then
|
||||||
direct_strategy = "ipv4_only"
|
direct_strategy = "ipv4_only"
|
||||||
@@ -1836,6 +1849,20 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if direct_dns_udp_server then
|
||||||
|
local nodes_domain = {}
|
||||||
|
local nodes_domain_text = sys.exec('uci show passwall2 | grep ".address=" | cut -d "\'" -f 2 | grep "[a-zA-Z]$" | sort -u')
|
||||||
|
string.gsub(nodes_domain_text, '[^' .. "\r\n" .. ']+', function(w)
|
||||||
|
table.insert(nodes_domain, w)
|
||||||
|
end)
|
||||||
|
if #nodes_domain > 0 then
|
||||||
|
table.insert(dns_domain_rules, 1, {
|
||||||
|
domain = nodes_domain,
|
||||||
|
outboundTag = "direct"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
remote_strategy = "prefer_ipv6"
|
remote_strategy = "prefer_ipv6"
|
||||||
if remote_dns_query_strategy == "UseIPv4" then
|
if remote_dns_query_strategy == "UseIPv4" then
|
||||||
remote_strategy = "ipv4_only"
|
remote_strategy = "ipv4_only"
|
||||||
@@ -1913,30 +1940,6 @@ function gen_config(var)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if direct_dns_udp_server then
|
|
||||||
local domain = {}
|
|
||||||
local nodes_domain_text = sys.exec('uci show passwall2 | grep ".address=" | cut -d "\'" -f 2 | grep "[a-zA-Z]$" | sort -u')
|
|
||||||
string.gsub(nodes_domain_text, '[^' .. "\r\n" .. ']+', function(w)
|
|
||||||
table.insert(domain, w)
|
|
||||||
end)
|
|
||||||
if #domain > 0 then
|
|
||||||
table.insert(dns_domain_rules, 1, {
|
|
||||||
domain = domain,
|
|
||||||
outboundTag = "direct"
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local server_port = tonumber(direct_dns_udp_port) or 53
|
|
||||||
|
|
||||||
table.insert(dns.servers, {
|
|
||||||
tag = "direct",
|
|
||||||
type = "udp",
|
|
||||||
server = direct_dns_udp_server,
|
|
||||||
server_port = server_port,
|
|
||||||
detour = "direct",
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
local default_dns_flag = "remote"
|
local default_dns_flag = "remote"
|
||||||
if node_id and redir_port then
|
if node_id and redir_port then
|
||||||
local node = get_node_by_id(node_id)
|
local node = get_node_by_id(node_id)
|
||||||
|
|||||||
@@ -8,7 +8,8 @@ local fs = api.fs
|
|||||||
local CACHE_PATH = api.CACHE_PATH
|
local CACHE_PATH = api.CACHE_PATH
|
||||||
|
|
||||||
local GLOBAL = {
|
local GLOBAL = {
|
||||||
DNS_SERVER = {}
|
DNS_SERVER = {},
|
||||||
|
DNS_HOSTNAME = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
local xray_version = api.get_app_version("xray")
|
local xray_version = api.get_app_version("xray")
|
||||||
@@ -442,6 +443,11 @@ function gen_outbound(flag, node, tag, proxy_table)
|
|||||||
else
|
else
|
||||||
config_port = 443
|
config_port = 443
|
||||||
end
|
end
|
||||||
|
if _a.hostname then
|
||||||
|
if api.datatypes.hostname(_a.hostname) then
|
||||||
|
GLOBAL.DNS_HOSTNAME[_a.hostname] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local server_address = node.domain_resolver_dns
|
local server_address = node.domain_resolver_dns
|
||||||
@@ -461,7 +467,11 @@ function gen_outbound(flag, node, tag, proxy_table)
|
|||||||
queryStrategy = node.domain_strategy or "UseIP",
|
queryStrategy = node.domain_strategy or "UseIP",
|
||||||
address = config_address,
|
address = config_address,
|
||||||
port = config_port,
|
port = config_port,
|
||||||
domains = {"full:" .. node.address}
|
domains = {"full:" .. node.address},
|
||||||
|
finalQuery = true,
|
||||||
|
disableCache = false,
|
||||||
|
serveStale = true,
|
||||||
|
serveExpiredTTL = 30,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1463,13 +1473,6 @@ function gen_config(var)
|
|||||||
local remote_fakedns_tag = "dns-in-remote-fakedns"
|
local remote_fakedns_tag = "dns-in-remote-fakedns"
|
||||||
local default_dns_tag = "dns-in-default"
|
local default_dns_tag = "dns-in-default"
|
||||||
|
|
||||||
for i, v in pairs(GLOBAL.DNS_SERVER) do
|
|
||||||
table.insert(dns_servers, {
|
|
||||||
server = v,
|
|
||||||
outboundTag = "direct"
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
dns = {
|
dns = {
|
||||||
tag = "dns-global",
|
tag = "dns-global",
|
||||||
hosts = {},
|
hosts = {},
|
||||||
@@ -1480,6 +1483,13 @@ function gen_config(var)
|
|||||||
queryStrategy = "UseIP"
|
queryStrategy = "UseIP"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for i, v in pairs(GLOBAL.DNS_SERVER) do
|
||||||
|
table.insert(dns_servers, {
|
||||||
|
server = v,
|
||||||
|
outboundTag = "direct"
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
local _direct_dns = nil
|
local _direct_dns = nil
|
||||||
if direct_dns_udp_server then
|
if direct_dns_udp_server then
|
||||||
_direct_dns = {
|
_direct_dns = {
|
||||||
@@ -1497,6 +1507,27 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if next(GLOBAL.DNS_HOSTNAME) then
|
||||||
|
local hostname = {}
|
||||||
|
for line, _ in pairs(GLOBAL.DNS_HOSTNAME) do
|
||||||
|
table.insert(hostname, line)
|
||||||
|
end
|
||||||
|
local new_dns_server
|
||||||
|
if _direct_dns then
|
||||||
|
new_dns_server = api.clone(_direct_dns)
|
||||||
|
else
|
||||||
|
new_dns_server = {
|
||||||
|
address = "localhost"
|
||||||
|
}
|
||||||
|
end
|
||||||
|
new_dns_server.tag = "dns-in-bootstrap"
|
||||||
|
new_dns_server.domains = hostname
|
||||||
|
table.insert(dns_servers, #dns_servers - 1, {
|
||||||
|
outboundTag = "direct",
|
||||||
|
server = new_dns_server
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
if dns_listen_port then
|
if dns_listen_port then
|
||||||
local _remote_dns_proto = "tcp"
|
local _remote_dns_proto = "tcp"
|
||||||
|
|
||||||
@@ -1604,9 +1635,13 @@ function gen_config(var)
|
|||||||
end)
|
end)
|
||||||
if #domain > 0 then
|
if #domain > 0 then
|
||||||
table.insert(dns.servers, 1, {
|
table.insert(dns.servers, 1, {
|
||||||
tag = "local",
|
tag = "dns-in-vpslist",
|
||||||
address = "localhost",
|
address = "localhost",
|
||||||
domains = domain
|
domains = domain,
|
||||||
|
finalQuery = true,
|
||||||
|
disableCache = false,
|
||||||
|
serveStale = true,
|
||||||
|
serveExpiredTTL = 30,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2121,11 +2156,15 @@ function gen_front_dns_config(var)
|
|||||||
end)
|
end)
|
||||||
if #node_domain > 0 then
|
if #node_domain > 0 then
|
||||||
table.insert(dns.servers, {
|
table.insert(dns.servers, {
|
||||||
tag = "direct",
|
tag = "dns-in-vpslist",
|
||||||
address = direct_dns_udp_server,
|
address = direct_dns_udp_server,
|
||||||
port = tonumber(direct_dns_udp_port) or 53,
|
port = tonumber(direct_dns_udp_port) or 53,
|
||||||
queryStrategy = queryStrategy,
|
queryStrategy = queryStrategy,
|
||||||
domains = node_domain
|
domains = node_domain,
|
||||||
|
finalQuery = true,
|
||||||
|
disableCache = false,
|
||||||
|
serveStale = true,
|
||||||
|
serveExpiredTTL = 30,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1776,6 +1776,9 @@ msgstr "حل مشکل DNS دامنه"
|
|||||||
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
||||||
msgstr "اگر آدرس گره یک نام دامنه باشد، از این DNS برای حل مسئله استفاده خواهد شد."
|
msgstr "اگر آدرس گره یک نام دامنه باشد، از این DNS برای حل مسئله استفاده خواهد شد."
|
||||||
|
|
||||||
|
msgid "Supports only Xray or Sing-box node types."
|
||||||
|
msgstr "فقط گرههای نوع Xray یا Sing-box پشتیبانی میشوند."
|
||||||
|
|
||||||
msgid "Chain Proxy"
|
msgid "Chain Proxy"
|
||||||
msgstr "پروکسی زنجیرهای"
|
msgstr "پروکسی زنجیرهای"
|
||||||
|
|
||||||
@@ -1792,9 +1795,6 @@ msgstr ""
|
|||||||
"پروکسی زنجیرهای فقط با گرههای Xray یا Sing-box کار میکند.<br>"
|
"پروکسی زنجیرهای فقط با گرههای Xray یا Sing-box کار میکند.<br>"
|
||||||
"شما فقط میتوانید از گرههای دستی یا وارد شده به عنوان گرههای زنجیرهای استفاده کنید."
|
"شما فقط میتوانید از گرههای دستی یا وارد شده به عنوان گرههای زنجیرهای استفاده کنید."
|
||||||
|
|
||||||
msgid "Set the default domain resolution strategy for the sing-box node."
|
|
||||||
msgstr "تنظیم استراتژی پیشفرض حل دامنه برای گره sing-box."
|
|
||||||
|
|
||||||
msgid "Prefer IPv4"
|
msgid "Prefer IPv4"
|
||||||
msgstr "ترجیح IPv4"
|
msgstr "ترجیح IPv4"
|
||||||
|
|
||||||
|
|||||||
@@ -1777,6 +1777,9 @@ msgstr "Разрешение DNS-запросов для домена"
|
|||||||
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
||||||
msgstr "Если адрес узла является доменным именем, для разрешения будет использоваться этот DNS-сервер."
|
msgstr "Если адрес узла является доменным именем, для разрешения будет использоваться этот DNS-сервер."
|
||||||
|
|
||||||
|
msgid "Supports only Xray or Sing-box node types."
|
||||||
|
msgstr "Поддерживаются только узлы типа Xray или Sing-box."
|
||||||
|
|
||||||
msgid "Chain Proxy"
|
msgid "Chain Proxy"
|
||||||
msgstr "Цепочка прокси"
|
msgstr "Цепочка прокси"
|
||||||
|
|
||||||
@@ -1793,9 +1796,6 @@ msgstr ""
|
|||||||
"Цепочка прокси работает только с серверами Xray или Sing-Box.<br>"
|
"Цепочка прокси работает только с серверами Xray или Sing-Box.<br>"
|
||||||
"В качестве звеньев цепочки можно использовать только серверы, добавленные вручную или импортированные."
|
"В качестве звеньев цепочки можно использовать только серверы, добавленные вручную или импортированные."
|
||||||
|
|
||||||
msgid "Set the default domain resolution strategy for the sing-box node."
|
|
||||||
msgstr "Задать стратегию разрешения доменов по умолчанию для сервера Sing-Box."
|
|
||||||
|
|
||||||
msgid "Prefer IPv4"
|
msgid "Prefer IPv4"
|
||||||
msgstr "Предпочитать IPv4"
|
msgstr "Предпочитать IPv4"
|
||||||
|
|
||||||
|
|||||||
@@ -1768,6 +1768,9 @@ msgstr "域名 DNS 解析"
|
|||||||
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
||||||
msgstr "如果节点地址是域名,则将使用此 DNS 进行解析。"
|
msgstr "如果节点地址是域名,则将使用此 DNS 进行解析。"
|
||||||
|
|
||||||
|
msgid "Supports only Xray or Sing-box node types."
|
||||||
|
msgstr "仅支持 Xray 或 Sing-box 类型节点。"
|
||||||
|
|
||||||
msgid "Chain Proxy"
|
msgid "Chain Proxy"
|
||||||
msgstr "链式代理"
|
msgstr "链式代理"
|
||||||
|
|
||||||
@@ -1781,12 +1784,9 @@ msgid ""
|
|||||||
"Chained proxy works only with Xray or Sing-box nodes.<br>"
|
"Chained proxy works only with Xray or Sing-box nodes.<br>"
|
||||||
"You can only use manual or imported nodes as chained nodes."
|
"You can only use manual or imported nodes as chained nodes."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"链式代理仅支持 Xray 与 Sing-box 节点。<br>"
|
"链式代理仅支持 Xray 或 Sing-box 节点。<br>"
|
||||||
"仅支持手动添加或导入的节点用作链式节点。"
|
"仅支持手动添加或导入的节点用作链式节点。"
|
||||||
|
|
||||||
msgid "Set the default domain resolution strategy for the sing-box node."
|
|
||||||
msgstr "为 sing-box 节点设置默认的域名解析策略。"
|
|
||||||
|
|
||||||
msgid "Prefer IPv4"
|
msgid "Prefer IPv4"
|
||||||
msgstr "IPv4 优先"
|
msgstr "IPv4 优先"
|
||||||
|
|
||||||
|
|||||||
@@ -1768,6 +1768,9 @@ msgstr "域名 DNS 解析"
|
|||||||
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
msgid "If the node address is a domain name, this DNS will be used for resolution."
|
||||||
msgstr "如果節點地址是域名,則將使用此 DNS 進行解析。"
|
msgstr "如果節點地址是域名,則將使用此 DNS 進行解析。"
|
||||||
|
|
||||||
|
msgid "Supports only Xray or Sing-box node types."
|
||||||
|
msgstr "僅支援 Xray 或 Sing-box 類型節點。"
|
||||||
|
|
||||||
msgid "Chain Proxy"
|
msgid "Chain Proxy"
|
||||||
msgstr "鏈式代理"
|
msgstr "鏈式代理"
|
||||||
|
|
||||||
@@ -1781,12 +1784,9 @@ msgid ""
|
|||||||
"Chained proxy works only with Xray or Sing-box nodes.<br>"
|
"Chained proxy works only with Xray or Sing-box nodes.<br>"
|
||||||
"You can only use manual or imported nodes as chained nodes."
|
"You can only use manual or imported nodes as chained nodes."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"鏈式代理仅支持 Xray 与 Sing-box 節點。<br>"
|
"鏈式代理仅支持 Xray 或 Sing-box 節點。<br>"
|
||||||
"仅支持手動添加或導入的節點用作鏈式節點。"
|
"仅支持手動添加或導入的節點用作鏈式節點。"
|
||||||
|
|
||||||
msgid "Set the default domain resolution strategy for the sing-box node."
|
|
||||||
msgstr "為 sing-box 節點設置默認的域名解析策略。"
|
|
||||||
|
|
||||||
msgid "Prefer IPv4"
|
msgid "Prefer IPv4"
|
||||||
msgstr "IPv4 優先"
|
msgstr "IPv4 優先"
|
||||||
|
|
||||||
|
|||||||
@@ -134,16 +134,10 @@ run_xray() {
|
|||||||
set_cache_var "node_${node}_direct_nftset6" "${direct_nftset6}"
|
set_cache_var "node_${node}_direct_nftset6" "${direct_nftset6}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
|
||||||
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
|
||||||
json_add_string "direct_dns_query_strategy" "${direct_dns_query_strategy}"
|
|
||||||
[ "$remote_fakedns" = "1" ] && {
|
[ "$remote_fakedns" = "1" ] && {
|
||||||
json_add_string "remote_dns_fake" "1"
|
json_add_string "remote_dns_fake" "1"
|
||||||
json_add_string "remote_dns_fake_strategy" "${remote_dns_query_strategy}"
|
json_add_string "remote_dns_fake_strategy" "${remote_dns_query_strategy}"
|
||||||
}
|
}
|
||||||
local _json1_arg="$(json_dump)"
|
|
||||||
|
|
||||||
json_init
|
|
||||||
case "$remote_dns_protocol" in
|
case "$remote_dns_protocol" in
|
||||||
udp)
|
udp)
|
||||||
local _dns=$(get_first_dns remote_dns_udp_server 53 | sed 's/#/:/g')
|
local _dns=$(get_first_dns remote_dns_udp_server 53 | sed 's/#/:/g')
|
||||||
@@ -178,20 +172,10 @@ run_xray() {
|
|||||||
[ -n "$remote_dns_detour" ] && json_add_string "remote_dns_detour" "${remote_dns_detour}"
|
[ -n "$remote_dns_detour" ] && json_add_string "remote_dns_detour" "${remote_dns_detour}"
|
||||||
[ -n "$remote_dns_query_strategy" ] && json_add_string "remote_dns_query_strategy" "${remote_dns_query_strategy}"
|
[ -n "$remote_dns_query_strategy" ] && json_add_string "remote_dns_query_strategy" "${remote_dns_query_strategy}"
|
||||||
[ -n "$remote_dns_client_ip" ] && json_add_string "remote_dns_client_ip" "${remote_dns_client_ip}"
|
[ -n "$remote_dns_client_ip" ] && json_add_string "remote_dns_client_ip" "${remote_dns_client_ip}"
|
||||||
local _json2_arg="$(json_dump)"
|
|
||||||
|
|
||||||
local _json2_keys key
|
|
||||||
json_load "${_json2_arg}"
|
|
||||||
json_get_keys _json2_keys
|
|
||||||
for key in ${_json2_keys}; do
|
|
||||||
json_get_var "_json2_$key" "$key"
|
|
||||||
done
|
|
||||||
json_load "${_json1_arg}"
|
|
||||||
for key in ${_json2_keys}; do
|
|
||||||
eval "local _v=\$_json2_$key"
|
|
||||||
json_add_string "$key" "$_v"
|
|
||||||
done
|
|
||||||
}
|
}
|
||||||
|
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
||||||
|
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
||||||
|
json_add_string "direct_dns_query_strategy" "${direct_dns_query_strategy}"
|
||||||
|
|
||||||
[ -n "${redir_port}" ] && {
|
[ -n "${redir_port}" ] && {
|
||||||
json_add_string "redir_port" "${redir_port}"
|
json_add_string "redir_port" "${redir_port}"
|
||||||
@@ -209,7 +193,7 @@ run_xray() {
|
|||||||
|
|
||||||
$XRAY_BIN run -test -c "$config_file" > $test_log_file; local status=$?
|
$XRAY_BIN run -test -c "$config_file" > $test_log_file; local status=$?
|
||||||
if [ "${status}" == 0 ]; then
|
if [ "${status}" == 0 ]; then
|
||||||
ln_run "$XRAY_BIN" xray $log_file run -c "$config_file"
|
ln_run ${QUEUE_RUN} "$XRAY_BIN" xray $log_file run -c "$config_file"
|
||||||
else
|
else
|
||||||
_error_log_file=$test_log_file
|
_error_log_file=$test_log_file
|
||||||
return ${status}
|
return ${status}
|
||||||
@@ -289,9 +273,6 @@ run_singbox() {
|
|||||||
set_cache_var "node_${node}_direct_nftset6" "${direct_nftset6}"
|
set_cache_var "node_${node}_direct_nftset6" "${direct_nftset6}"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
|
||||||
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
|
||||||
json_add_string "direct_dns_query_strategy" "${direct_dns_query_strategy}"
|
|
||||||
|
|
||||||
case "$remote_dns_protocol" in
|
case "$remote_dns_protocol" in
|
||||||
udp|\
|
udp|\
|
||||||
@@ -339,6 +320,9 @@ run_singbox() {
|
|||||||
[ -n "$dns_cache" ] && json_add_string "dns_cache" "${dns_cache}"
|
[ -n "$dns_cache" ] && json_add_string "dns_cache" "${dns_cache}"
|
||||||
[ "$remote_fakedns" = "1" ] && json_add_string "remote_dns_fake" "1"
|
[ "$remote_fakedns" = "1" ] && json_add_string "remote_dns_fake" "1"
|
||||||
}
|
}
|
||||||
|
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
||||||
|
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
||||||
|
json_add_string "direct_dns_query_strategy" "${direct_dns_query_strategy}"
|
||||||
|
|
||||||
[ -n "${redir_port}" ] && {
|
[ -n "${redir_port}" ] && {
|
||||||
json_add_string "redir_port" "${redir_port}"
|
json_add_string "redir_port" "${redir_port}"
|
||||||
@@ -356,7 +340,7 @@ run_singbox() {
|
|||||||
|
|
||||||
$SINGBOX_BIN check -c "$config_file" > $test_log_file 2>&1; local status=$?
|
$SINGBOX_BIN check -c "$config_file" > $test_log_file 2>&1; local status=$?
|
||||||
if [ "${status}" == 0 ]; then
|
if [ "${status}" == 0 ]; then
|
||||||
ln_run "$SINGBOX_BIN" "sing-box" "${log_file}" run -c "$config_file"
|
ln_run ${QUEUE_RUN} "$SINGBOX_BIN" "sing-box" "${log_file}" run -c "$config_file"
|
||||||
else
|
else
|
||||||
_error_log_file=$test_log_file
|
_error_log_file=$test_log_file
|
||||||
return ${status}
|
return ${status}
|
||||||
@@ -435,9 +419,12 @@ run_socks() {
|
|||||||
json_add_string "flag" "SOCKS_${flag}"
|
json_add_string "flag" "SOCKS_${flag}"
|
||||||
json_add_string "local_socks_address" "${bind}"
|
json_add_string "local_socks_address" "${bind}"
|
||||||
json_add_string "local_socks_port" "${socks_port}"
|
json_add_string "local_socks_port" "${socks_port}"
|
||||||
|
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
||||||
|
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
||||||
|
json_add_string "direct_dns_query_strategy" "${DIRECT_DNS_QUERY_STRATEGY}"
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_SINGBOX gen_config "${_json_arg}" > $config_file
|
lua $UTIL_SINGBOX gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$SINGBOX_BIN" "sing-box" /dev/null run -c "$config_file"
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$SINGBOX_BIN" "sing-box" /dev/null run -c "$config_file"
|
||||||
;;
|
;;
|
||||||
xray)
|
xray)
|
||||||
[ "$http_port" != "0" ] && {
|
[ "$http_port" != "0" ] && {
|
||||||
@@ -454,9 +441,12 @@ run_socks() {
|
|||||||
json_add_string "flag" "SOCKS_${flag}"
|
json_add_string "flag" "SOCKS_${flag}"
|
||||||
json_add_string "local_socks_address" "${bind}"
|
json_add_string "local_socks_address" "${bind}"
|
||||||
json_add_string "local_socks_port" "${socks_port}"
|
json_add_string "local_socks_port" "${socks_port}"
|
||||||
|
json_add_string "direct_dns_udp_port" "${DIRECT_DNS_UDP_PORT}"
|
||||||
|
json_add_string "direct_dns_udp_server" "${DIRECT_DNS_UDP_SERVER}"
|
||||||
|
json_add_string "direct_dns_query_strategy" "${DIRECT_DNS_QUERY_STRATEGY}"
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_XRAY gen_config "${_json_arg}" > $config_file
|
lua $UTIL_XRAY gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$XRAY_BIN" "xray" $log_file run -c "$config_file"
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$XRAY_BIN" "xray" $log_file run -c "$config_file"
|
||||||
;;
|
;;
|
||||||
naiveproxy)
|
naiveproxy)
|
||||||
json_add_string "local_addr" "${bind}"
|
json_add_string "local_addr" "${bind}"
|
||||||
@@ -464,14 +454,14 @@ run_socks() {
|
|||||||
json_add_string "run_type" "socks"
|
json_add_string "run_type" "socks"
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_NAIVE gen_config "${_json_arg}" > $config_file
|
lua $UTIL_NAIVE gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$(first_type naive)" naive $log_file "$config_file"
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type naive)" naive $log_file "$config_file"
|
||||||
;;
|
;;
|
||||||
ssr)
|
ssr)
|
||||||
json_add_string "local_addr" "${bind}"
|
json_add_string "local_addr" "${bind}"
|
||||||
json_add_string "local_port" "${socks_port}"
|
json_add_string "local_port" "${socks_port}"
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_SS gen_config "${_json_arg}" > $config_file
|
lua $UTIL_SS gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$(first_type ssr-local)" "ssr-local" $log_file -c "$config_file" -v -u
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type ssr-local)" "ssr-local" $log_file -c "$config_file" -v -u
|
||||||
;;
|
;;
|
||||||
ss)
|
ss)
|
||||||
json_add_string "local_addr" "${bind}"
|
json_add_string "local_addr" "${bind}"
|
||||||
@@ -483,7 +473,7 @@ run_socks() {
|
|||||||
}
|
}
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_SS gen_config "${_json_arg}" > $config_file
|
lua $UTIL_SS gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type ss-local)" "ss-local" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
ss-rust)
|
ss-rust)
|
||||||
json_add_string "local_socks_address" "${bind}"
|
json_add_string "local_socks_address" "${bind}"
|
||||||
@@ -500,7 +490,7 @@ run_socks() {
|
|||||||
}
|
}
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_SS gen_config "${_json_arg}" > $config_file
|
lua $UTIL_SS gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type sslocal)" "sslocal" $log_file -c "$config_file" -v
|
||||||
;;
|
;;
|
||||||
hysteria2)
|
hysteria2)
|
||||||
json_add_string "local_socks_address" "${bind}"
|
json_add_string "local_socks_address" "${bind}"
|
||||||
@@ -513,14 +503,14 @@ run_socks() {
|
|||||||
}
|
}
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_HYSTERIA2 gen_config "${_json_arg}" > $config_file
|
lua $UTIL_HYSTERIA2 gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type $(config_t_get global_app hysteria_file))" "hysteria" $log_file -c "$config_file" client
|
||||||
;;
|
;;
|
||||||
tuic)
|
tuic)
|
||||||
json_add_string "local_addr" "${bind}"
|
json_add_string "local_addr" "${bind}"
|
||||||
json_add_string "local_port" "${socks_port}"
|
json_add_string "local_port" "${socks_port}"
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
lua $UTIL_TUIC gen_config "${_json_arg}" > $config_file
|
lua $UTIL_TUIC gen_config "${_json_arg}" > $config_file
|
||||||
[ -z "$no_run" ] && ln_run "$(first_type tuic-client)" "tuic-client" $log_file -c "$config_file"
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "$(first_type tuic-client)" "tuic-client" $log_file -c "$config_file"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@@ -545,7 +535,7 @@ run_socks() {
|
|||||||
fi
|
fi
|
||||||
[ -n "${bin}" ] && [ -n "${util}" ] && {
|
[ -n "${bin}" ] && [ -n "${util}" ] && {
|
||||||
lua ${util} gen_proto_config "${_json_arg}" > ${http_config_file}
|
lua ${util} gen_proto_config "${_json_arg}" > ${http_config_file}
|
||||||
[ -z "$no_run" ] && ln_run "${bin}" ${type} /dev/null run -c ${http_config_file}
|
[ -z "$no_run" ] && ln_run ${QUEUE_RUN} "${bin}" ${type} /dev/null run -c ${http_config_file}
|
||||||
}
|
}
|
||||||
unset bin util
|
unset bin util
|
||||||
}
|
}
|
||||||
@@ -699,16 +689,16 @@ run_front_dns() {
|
|||||||
}
|
}
|
||||||
local _json_arg="$(json_dump)"
|
local _json_arg="$(json_dump)"
|
||||||
|
|
||||||
local preferred_core=""
|
local prefer_core=""
|
||||||
[ -n "${XRAY_BIN}" ] && preferred_core="xray"
|
[ -n "${XRAY_BIN}" ] && prefer_core="xray"
|
||||||
[ -n "${SINGBOX_BIN}" ] && preferred_core="sing-box"
|
[ -n "${SINGBOX_BIN}" ] && prefer_core="sing-box"
|
||||||
|
|
||||||
if [ "${preferred_core}" = "xray" ]; then
|
if [ "${prefer_core}" = "xray" ]; then
|
||||||
lua $UTIL_XRAY gen_front_dns_config "${_json_arg}" > $config_file
|
lua $UTIL_XRAY gen_front_dns_config "${_json_arg}" > $config_file
|
||||||
ln_run "$XRAY_BIN" "xray" "${log_file}" run -c "$config_file"
|
ln_run 0 "$XRAY_BIN" "xray" "${log_file}" run -c "$config_file"
|
||||||
elif [ "${preferred_core}" = "sing-box" ]; then
|
elif [ "${prefer_core}" = "sing-box" ]; then
|
||||||
lua $UTIL_SINGBOX gen_front_dns_config "${_json_arg}" > $config_file
|
lua $UTIL_SINGBOX gen_front_dns_config "${_json_arg}" > $config_file
|
||||||
ln_run "$SINGBOX_BIN" "sing-box" "${log_file}" run -c "$config_file"
|
ln_run 0 "$SINGBOX_BIN" "sing-box" "${log_file}" run -c "$config_file"
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
@@ -743,7 +733,7 @@ run_global_dnsmasq() {
|
|||||||
json_add_string "DNSMASQ_CONF" "${DIRECT_DNSMASQ_CONF}"
|
json_add_string "DNSMASQ_CONF" "${DIRECT_DNSMASQ_CONF}"
|
||||||
json_add_string "TMP_DNSMASQ_PATH" "${DIRECT_DNSMASQ_CONF_PATH}"
|
json_add_string "TMP_DNSMASQ_PATH" "${DIRECT_DNSMASQ_CONF_PATH}"
|
||||||
lua $APP_PATH/helper_dnsmasq.lua copy_instance "$(json_dump)"
|
lua $APP_PATH/helper_dnsmasq.lua copy_instance "$(json_dump)"
|
||||||
ln_run "$(first_type dnsmasq)" "dnsmasq_direct" "/dev/null" -C ${DIRECT_DNSMASQ_CONF} -x ${GLOBAL_ACL_PATH}/direct_dnsmasq.pid
|
ln_run 0 "$(first_type dnsmasq)" "dnsmasq_direct" "/dev/null" -C ${DIRECT_DNSMASQ_CONF} -x ${GLOBAL_ACL_PATH}/direct_dnsmasq.pid
|
||||||
set_cache_var "DIRECT_DNSMASQ_PORT" "${DIRECT_DNSMASQ_PORT}"
|
set_cache_var "DIRECT_DNSMASQ_PORT" "${DIRECT_DNSMASQ_PORT}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,7 +759,7 @@ run_global_dnsmasq() {
|
|||||||
else
|
else
|
||||||
#Run a copy dnsmasq instance, DNS hijack for that need proxy devices.
|
#Run a copy dnsmasq instance, DNS hijack for that need proxy devices.
|
||||||
GLOBAL_DNSMASQ_PORT=$(get_new_port 11400)
|
GLOBAL_DNSMASQ_PORT=$(get_new_port 11400)
|
||||||
run_copy_dnsmasq flag="default" listen_port=$GLOBAL_DNSMASQ_PORT tun_dns="${DNSMASQ_TUN_DNS}"
|
run_copy_dnsmasq flag="default" listen_port=$GLOBAL_DNSMASQ_PORT local_dns="${DNSMASQ_LOCAL_DNS}" tun_dns="${DNSMASQ_TUN_DNS}" default_dns="${DNSMASQ_DEFAULT_DNS}"
|
||||||
DNS_REDIRECT_PORT=${GLOBAL_DNSMASQ_PORT}
|
DNS_REDIRECT_PORT=${GLOBAL_DNSMASQ_PORT}
|
||||||
#dhcp.leases to hosts
|
#dhcp.leases to hosts
|
||||||
$APP_PATH/lease2hosts.sh > /dev/null 2>&1 &
|
$APP_PATH/lease2hosts.sh > /dev/null 2>&1 &
|
||||||
@@ -944,11 +934,11 @@ start_haproxy() {
|
|||||||
haproxy_path=$TMP_PATH/haproxy
|
haproxy_path=$TMP_PATH/haproxy
|
||||||
haproxy_conf="config.cfg"
|
haproxy_conf="config.cfg"
|
||||||
lua $APP_PATH/haproxy.lua -path ${haproxy_path} -conf ${haproxy_conf} -dns ${LOCAL_DNS:-${AUTO_DNS}}
|
lua $APP_PATH/haproxy.lua -path ${haproxy_path} -conf ${haproxy_conf} -dns ${LOCAL_DNS:-${AUTO_DNS}}
|
||||||
ln_run "$(first_type haproxy)" haproxy "/dev/null" -f "${haproxy_path}/${haproxy_conf}"
|
ln_run ${QUEUE_RUN} "$(first_type haproxy)" haproxy "/dev/null" -f "${haproxy_path}/${haproxy_conf}"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_copy_dnsmasq() {
|
run_copy_dnsmasq() {
|
||||||
local flag listen_port tun_dns
|
local flag listen_port local_dns tun_dns default_dns
|
||||||
eval_set_val $@
|
eval_set_val $@
|
||||||
local dnsmasq_conf=$TMP_ACL_PATH/$flag/dnsmasq.conf
|
local dnsmasq_conf=$TMP_ACL_PATH/$flag/dnsmasq.conf
|
||||||
local dnsmasq_conf_path=$TMP_ACL_PATH/$flag/dnsmasq.d
|
local dnsmasq_conf_path=$TMP_ACL_PATH/$flag/dnsmasq.d
|
||||||
@@ -963,14 +953,14 @@ run_copy_dnsmasq() {
|
|||||||
json_add_string "FLAG" "${flag}"
|
json_add_string "FLAG" "${flag}"
|
||||||
json_add_string "TMP_DNSMASQ_PATH" "${dnsmasq_conf_path}"
|
json_add_string "TMP_DNSMASQ_PATH" "${dnsmasq_conf_path}"
|
||||||
json_add_string "DNSMASQ_CONF_FILE" "${dnsmasq_conf}"
|
json_add_string "DNSMASQ_CONF_FILE" "${dnsmasq_conf}"
|
||||||
json_add_string "DEFAULT_DNS" "${AUTO_DNS}"
|
json_add_string "DEFAULT_DNS" "${default_dns}"
|
||||||
json_add_string "LOCAL_DNS" "${LOCAL_DNS:-${AUTO_DNS}}"
|
json_add_string "LOCAL_DNS" "${local_dns}"
|
||||||
json_add_string "TUN_DNS" "${tun_dns}"
|
json_add_string "TUN_DNS" "${tun_dns}"
|
||||||
json_add_string "NFTFLAG" "${nftflag:-0}"
|
json_add_string "NFTFLAG" "${nftflag:-0}"
|
||||||
json_add_string "NO_LOGIC_LOG" "${NO_LOGIC_LOG:-0}"
|
json_add_string "NO_LOGIC_LOG" "${NO_LOGIC_LOG:-0}"
|
||||||
lua $APP_PATH/helper_dnsmasq.lua add_rule "$(json_dump)"
|
lua $APP_PATH/helper_dnsmasq.lua add_rule "$(json_dump)"
|
||||||
|
|
||||||
ln_run "$(first_type dnsmasq)" "dnsmasq_${flag}" "/dev/null" -C $dnsmasq_conf -x $TMP_ACL_PATH/$flag/dnsmasq.pid
|
ln_run 0 "$(first_type dnsmasq)" "dnsmasq_${flag}" "/dev/null" -C $dnsmasq_conf -x $TMP_ACL_PATH/$flag/dnsmasq.pid
|
||||||
set_cache_var "ACL_${flag}_dns_port" "${listen_port}"
|
set_cache_var "ACL_${flag}_dns_port" "${listen_port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1011,7 +1001,7 @@ run_ipset_chinadns_ng() {
|
|||||||
group-upstream ${server_dns}
|
group-upstream ${server_dns}
|
||||||
group-ipset ${vps_set_names}
|
group-ipset ${vps_set_names}
|
||||||
EOF
|
EOF
|
||||||
ln_run "$(first_type chinadns-ng)" "chinadns-ng" "/dev/null" -C $config_file -v
|
ln_run 0 "$(first_type chinadns-ng)" "chinadns-ng" "/dev/null" -C $config_file -v
|
||||||
}
|
}
|
||||||
|
|
||||||
run_ipset_dnsmasq() {
|
run_ipset_dnsmasq() {
|
||||||
@@ -1030,7 +1020,7 @@ run_ipset_dnsmasq() {
|
|||||||
done
|
done
|
||||||
[ -n "${ipset}" ] && echo "ipset=${ipset}" >> $config_file
|
[ -n "${ipset}" ] && echo "ipset=${ipset}" >> $config_file
|
||||||
[ -n "${nftset}" ] && echo "nftset=${nftset}" >> $config_file
|
[ -n "${nftset}" ] && echo "nftset=${nftset}" >> $config_file
|
||||||
ln_run "$(first_type dnsmasq)" "dnsmasq" "/dev/null" -C $config_file
|
ln_run 0 "$(first_type dnsmasq)" "dnsmasq" "/dev/null" -C $config_file
|
||||||
}
|
}
|
||||||
|
|
||||||
acl_app() {
|
acl_app() {
|
||||||
@@ -1154,7 +1144,7 @@ acl_app() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1))
|
dnsmasq_port=$(get_new_port $(expr $dnsmasq_port + 1))
|
||||||
run_copy_dnsmasq flag="$sid" listen_port=$dnsmasq_port tun_dns="127.0.0.1#${dns_port}"
|
run_copy_dnsmasq flag="$sid" listen_port=$dnsmasq_port local_dns="${LOCAL_DNS:-${AUTO_DNS}}" tun_dns="127.0.0.1#${dns_port}" default_dns="${AUTO_DNS}"
|
||||||
#dhcp.leases to hostsMore actions
|
#dhcp.leases to hostsMore actions
|
||||||
$APP_PATH/lease2hosts.sh > /dev/null 2>&1 &
|
$APP_PATH/lease2hosts.sh > /dev/null 2>&1 &
|
||||||
|
|
||||||
@@ -1177,7 +1167,6 @@ start() {
|
|||||||
stop
|
stop
|
||||||
}
|
}
|
||||||
mkdir -p /tmp/etc /tmp/log $TMP_PATH $TMP_BIN_PATH $TMP_SCRIPT_FUNC_PATH $TMP_ROUTE_PATH $TMP_ACL_PATH $TMP_PATH2
|
mkdir -p /tmp/etc /tmp/log $TMP_PATH $TMP_BIN_PATH $TMP_SCRIPT_FUNC_PATH $TMP_ROUTE_PATH $TMP_ACL_PATH $TMP_PATH2
|
||||||
get_config
|
|
||||||
export V2RAY_LOCATION_ASSET=$(config_t_get global_rules v2ray_location_asset "/usr/share/v2ray/")
|
export V2RAY_LOCATION_ASSET=$(config_t_get global_rules v2ray_location_asset "/usr/share/v2ray/")
|
||||||
export XRAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET
|
export XRAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET
|
||||||
export ENABLE_DEPRECATED_GEOSITE=true
|
export ENABLE_DEPRECATED_GEOSITE=true
|
||||||
@@ -1217,6 +1206,7 @@ start() {
|
|||||||
sysctl -w net.bridge.bridge-nf-call-ip6tables=0 >/dev/null 2>&1
|
sysctl -w net.bridge.bridge-nf-call-ip6tables=0 >/dev/null 2>&1
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
run_process_queue
|
||||||
start_crontab
|
start_crontab
|
||||||
log_i18n 0 "Running complete!"
|
log_i18n 0 "Running complete!"
|
||||||
echolog "\n"
|
echolog "\n"
|
||||||
@@ -1346,15 +1336,21 @@ get_config() {
|
|||||||
fi
|
fi
|
||||||
set_cache_var GLOBAL_DNSMASQ_CONF ${DNSMASQ_CONF_DIR}/dnsmasq-${CONFIG}.conf
|
set_cache_var GLOBAL_DNSMASQ_CONF ${DNSMASQ_CONF_DIR}/dnsmasq-${CONFIG}.conf
|
||||||
set_cache_var GLOBAL_DNSMASQ_CONF_PATH ${GLOBAL_ACL_PATH}/dnsmasq.d
|
set_cache_var GLOBAL_DNSMASQ_CONF_PATH ${GLOBAL_ACL_PATH}/dnsmasq.d
|
||||||
|
|
||||||
|
QUEUE_RUN=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_config
|
||||||
|
|
||||||
arg1=$1
|
arg1=$1
|
||||||
shift
|
shift
|
||||||
case $arg1 in
|
case $arg1 in
|
||||||
run_socks)
|
run_socks)
|
||||||
|
QUEUE_RUN=0
|
||||||
run_socks $@
|
run_socks $@
|
||||||
;;
|
;;
|
||||||
socks_node_switch)
|
socks_node_switch)
|
||||||
|
QUEUE_RUN=0
|
||||||
socks_node_switch $@
|
socks_node_switch $@
|
||||||
;;
|
;;
|
||||||
start)
|
start)
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ while [ "$ENABLED" -eq 1 ]; do
|
|||||||
for filename in $(ls ${TMP_SCRIPT_FUNC_PATH} | grep -v "^_"); do
|
for filename in $(ls ${TMP_SCRIPT_FUNC_PATH} | grep -v "^_"); do
|
||||||
cmd=$(cat ${TMP_SCRIPT_FUNC_PATH}/${filename})
|
cmd=$(cat ${TMP_SCRIPT_FUNC_PATH}/${filename})
|
||||||
cmd_check=$(echo $cmd | awk -F '>' '{print $1}')
|
cmd_check=$(echo $cmd | awk -F '>' '{print $1}')
|
||||||
[ -n "$(echo $cmd_check | grep "dns2socks")" ] && cmd_check=$(echo $cmd_check | sed "s#:# #g")
|
|
||||||
icount=$(pgrep -f "$(echo $cmd_check)" | wc -l)
|
icount=$(pgrep -f "$(echo $cmd_check)" | wc -l)
|
||||||
if [ $icount = 0 ]; then
|
if [ $icount = 0 ]; then
|
||||||
#echo "${cmd} crashed, restarting." >> /tmp/log/passwall2.log
|
#echo "${cmd} crashed, restarting." >> /tmp/log/passwall2.log
|
||||||
|
|||||||
@@ -49,9 +49,9 @@ test_node() {
|
|||||||
local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z')
|
local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z')
|
||||||
[ -n "${_type}" ] && {
|
[ -n "${_type}" ] && {
|
||||||
local _tmp_port=$(get_new_port 48800 tcp,udp)
|
local _tmp_port=$(get_new_port 48800 tcp,udp)
|
||||||
$APP_FILE run_socks flag="test_node_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=test_node_${node_id}.json
|
NO_REC_PROCESS=1 $APP_FILE run_socks flag="test_node_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=test_node_${node_id}.json
|
||||||
|
sleep 2s
|
||||||
local curlx="socks5h://127.0.0.1:${_tmp_port}"
|
local curlx="socks5h://127.0.0.1:${_tmp_port}"
|
||||||
sleep 1s
|
|
||||||
local _proxy_status=$(test_url "${probe_url}" ${retry_num} ${connect_timeout} "-x $curlx")
|
local _proxy_status=$(test_url "${probe_url}" ${retry_num} ${connect_timeout} "-x $curlx")
|
||||||
# Kill the SS plugin process
|
# Kill the SS plugin process
|
||||||
local pid_file="/tmp/etc/${CONFIG}/test_node_${node_id}_plugin.pid"
|
local pid_file="/tmp/etc/${CONFIG}/test_node_${node_id}_plugin.pid"
|
||||||
|
|||||||
@@ -42,8 +42,7 @@ local core_has = {
|
|||||||
["xray"] = has_xray, ["sing-box"] = has_singbox, ["shadowsocks-libev"] = has_ss,["shadowsocks-rust"] = has_ss_rust,
|
["xray"] = has_xray, ["sing-box"] = has_singbox, ["shadowsocks-libev"] = has_ss,["shadowsocks-rust"] = has_ss_rust,
|
||||||
["hysteria2"] = has_hysteria2
|
["hysteria2"] = has_hysteria2
|
||||||
}
|
}
|
||||||
local domain_strategy_default = uci:get(appname, "@global_subscribe[0]", "domain_strategy") or ""
|
local domain_resolver, domain_resolver_dns, domain_resolver_dns_https, domain_strategy
|
||||||
local domain_strategy_node = ""
|
|
||||||
local preproxy_node_group, to_node_group, chain_node_type = "", "", ""
|
local preproxy_node_group, to_node_group, chain_node_type = "", "", ""
|
||||||
-- Determine whether to filter node keywords
|
-- Determine whether to filter node keywords
|
||||||
local filter_keyword_mode_default = uci:get(appname, "@global_subscribe[0]", "filter_keyword_mode") or "0"
|
local filter_keyword_mode_default = uci:get(appname, "@global_subscribe[0]", "filter_keyword_mode") or "0"
|
||||||
@@ -1842,9 +1841,22 @@ local function update_node(manual)
|
|||||||
if kkk ~= "group" or vvv ~= "default" then
|
if kkk ~= "group" or vvv ~= "default" then
|
||||||
uci:set(appname, cfgid, kkk, vvv)
|
uci:set(appname, cfgid, kkk, vvv)
|
||||||
end
|
end
|
||||||
-- Sing-Box Domain Strategy
|
-- Sing-Box Node Domain resolver
|
||||||
if kkk == "type" and vvv == "sing-box" then
|
if kkk == "type" and (vvv == "Xray" or vvv == "sing-box") then
|
||||||
uci:set(appname, cfgid, "domain_strategy", domain_strategy_node)
|
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
|
end
|
||||||
-- Subscription Group Chain Agent
|
-- Subscription Group Chain Agent
|
||||||
if chain_node_type ~= "" and kkk == "type" and (vvv == "Xray" or vvv == "sing-box") then
|
if chain_node_type ~= "" and kkk == "type" and (vvv == "Xray" or vvv == "sing-box") then
|
||||||
@@ -2059,12 +2071,11 @@ local execute = function()
|
|||||||
if hysteria2_type ~= "global" and core_has[hysteria2_type] then
|
if hysteria2_type ~= "global" and core_has[hysteria2_type] then
|
||||||
hysteria2_type_default = hysteria2_type
|
hysteria2_type_default = hysteria2_type
|
||||||
end
|
end
|
||||||
local domain_strategy = value.domain_strategy or "global"
|
|
||||||
if domain_strategy ~= "global" then
|
domain_resolver = value.domain_resolver
|
||||||
domain_strategy_node = domain_strategy
|
domain_resolver_dns = value.domain_resolver_dns
|
||||||
else
|
domain_resolver_dns_https = value.domain_resolver_dns_https
|
||||||
domain_strategy_node = domain_strategy_default
|
domain_strategy = (value.domain_strategy == "UseIPv4" or value.domain_strategy == "UseIPv6") and value.domain_strategy or nil
|
||||||
end
|
|
||||||
|
|
||||||
-- Subscription Group Chain Agent
|
-- Subscription Group Chain Agent
|
||||||
local function valid_chain_node(node)
|
local function valid_chain_node(node)
|
||||||
|
|||||||
@@ -47,9 +47,9 @@ url_test_node() {
|
|||||||
local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z')
|
local _type=$(echo $(config_n_get ${node_id} type) | tr 'A-Z' 'a-z')
|
||||||
[ -n "${_type}" ] && {
|
[ -n "${_type}" ] && {
|
||||||
local _tmp_port=$(get_new_port 48900 tcp,udp)
|
local _tmp_port=$(get_new_port 48900 tcp,udp)
|
||||||
/usr/share/${CONFIG}/app.sh run_socks flag="url_test_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=url_test_${node_id}.json
|
NO_REC_PROCESS=1 /usr/share/${CONFIG}/app.sh run_socks flag="url_test_${node_id}" node=${node_id} bind=127.0.0.1 socks_port=${_tmp_port} config_file=url_test_${node_id}.json
|
||||||
|
sleep 2s
|
||||||
local curlx="socks5h://127.0.0.1:${_tmp_port}"
|
local curlx="socks5h://127.0.0.1:${_tmp_port}"
|
||||||
sleep 1s
|
|
||||||
local url=$(config_t_get global_other url_test_url https://www.google.com/generate_204)
|
local url=$(config_t_get global_other url_test_url https://www.google.com/generate_204)
|
||||||
result=$(curl --connect-timeout 3 -o /dev/null -I -skL -w "%{http_code}:%{time_starttransfer}" -x $curlx "${url}")
|
result=$(curl --connect-timeout 3 -o /dev/null -I -skL -w "%{http_code}:%{time_starttransfer}" -x $curlx "${url}")
|
||||||
pgrep -af "url_test_${node_id}" | awk '! /test\.sh/{print $1}' | xargs kill -9 >/dev/null 2>&1
|
pgrep -af "url_test_${node_id}" | awk '! /test\.sh/{print $1}' | xargs kill -9 >/dev/null 2>&1
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ TMP_BIN_PATH=${TMP_PATH}/bin
|
|||||||
TMP_IFACE_PATH=${TMP_PATH}/iface
|
TMP_IFACE_PATH=${TMP_PATH}/iface
|
||||||
TMP_ROUTE_PATH=${TMP_PATH}/route
|
TMP_ROUTE_PATH=${TMP_PATH}/route
|
||||||
TMP_SCRIPT_FUNC_PATH=${TMP_PATH}/script_func
|
TMP_SCRIPT_FUNC_PATH=${TMP_PATH}/script_func
|
||||||
|
TMP_PROCESS_LIST_PATH=${TMP_PATH}/process_list
|
||||||
|
|
||||||
. /lib/functions/network.sh
|
. /lib/functions/network.sh
|
||||||
|
|
||||||
@@ -69,6 +70,7 @@ set_cache_var() {
|
|||||||
shift 1
|
shift 1
|
||||||
local val="$@"
|
local val="$@"
|
||||||
[ -n "${key}" ] && [ -n "${val}" ] && {
|
[ -n "${key}" ] && [ -n "${val}" ] && {
|
||||||
|
[ ! -d $TMP_PATH ] && mkdir -p $TMP_PATH
|
||||||
sed -i "/${key}=/d" $TMP_PATH/var >/dev/null 2>&1
|
sed -i "/${key}=/d" $TMP_PATH/var >/dev/null 2>&1
|
||||||
echo "${key}=\"${val}\"" >> $TMP_PATH/var
|
echo "${key}=\"${val}\"" >> $TMP_PATH/var
|
||||||
eval ${key}=\"${val}\"
|
eval ${key}=\"${val}\"
|
||||||
@@ -372,11 +374,12 @@ delete_ip2route() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ln_run() {
|
ln_run() {
|
||||||
local file_func=${1}
|
local queue_run=${1}
|
||||||
local ln_name=${2}
|
local file_func=${2}
|
||||||
local output=${3}
|
local ln_name=${3}
|
||||||
|
local output=${4}
|
||||||
|
shift 4;
|
||||||
|
|
||||||
shift 3;
|
|
||||||
if [ "${file_func%%/*}" != "${file_func}" ]; then
|
if [ "${file_func%%/*}" != "${file_func}" ]; then
|
||||||
[ ! -L "${file_func}" ] && {
|
[ ! -L "${file_func}" ] && {
|
||||||
ln -s "${file_func}" "${TMP_BIN_PATH}/${ln_name}" >/dev/null 2>&1
|
ln -s "${file_func}" "${TMP_BIN_PATH}/${ln_name}" >/dev/null 2>&1
|
||||||
@@ -386,16 +389,37 @@ ln_run() {
|
|||||||
fi
|
fi
|
||||||
#echo "${file_func} $*" >&2
|
#echo "${file_func} $*" >&2
|
||||||
[ -n "${file_func}" ] || log 1 "$(i18n "%s not found, unable to start..." "${ln_name}")"
|
[ -n "${file_func}" ] || log 1 "$(i18n "%s not found, unable to start..." "${ln_name}")"
|
||||||
|
|
||||||
|
[ "${queue_run}" == "1" ] && {
|
||||||
|
mkdir -p $TMP_PROCESS_LIST_PATH
|
||||||
|
process_count=$(ls $TMP_PROCESS_LIST_PATH | grep -v "^_" | wc -l)
|
||||||
|
process_count=$((process_count + 1))
|
||||||
|
echo "${file_func:-log 1 "${ln_name}"} $@ >${output}" > $TMP_PROCESS_LIST_PATH/$process_count
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
${file_func:-log 1 "${ln_name}"} "$@" >${output} 2>&1 &
|
${file_func:-log 1 "${ln_name}"} "$@" >${output} 2>&1 &
|
||||||
|
|
||||||
local pid=${!}
|
[ -n "$NO_REC_PROCESS" ] && return
|
||||||
#sleep 1s
|
|
||||||
#kill -0 ${pid} 2>/dev/null
|
|
||||||
#local status_code=${?}
|
|
||||||
process_count=$(ls $TMP_SCRIPT_FUNC_PATH | grep -v "^_" | wc -l)
|
process_count=$(ls $TMP_SCRIPT_FUNC_PATH | grep -v "^_" | wc -l)
|
||||||
process_count=$((process_count + 1))
|
process_count=$((process_count + 1))
|
||||||
echo "${file_func:-log 1 "${ln_name}"} $@ >${output}" > $TMP_SCRIPT_FUNC_PATH/$process_count
|
echo "${file_func:-log 1 "${ln_name}"} $@ >${output}" > $TMP_SCRIPT_FUNC_PATH/$process_count
|
||||||
#return ${status_code}
|
}
|
||||||
|
|
||||||
|
run_process_queue() {
|
||||||
|
[ -d ${TMP_PROCESS_LIST_PATH} ] && {
|
||||||
|
for filename in $(ls ${TMP_PROCESS_LIST_PATH}); do
|
||||||
|
cmd=$(cat ${TMP_PROCESS_LIST_PATH}/${filename})
|
||||||
|
cmd_check=$(echo $cmd | awk -F '>' '{print $1}')
|
||||||
|
icount=$(pgrep -f "$(echo $cmd_check)" | wc -l)
|
||||||
|
if [ $icount = 0 ]; then
|
||||||
|
eval $(echo "nohup ${cmd} 2>&1 &") >/dev/null 2>&1 &
|
||||||
|
fi
|
||||||
|
rm -rf ${TMP_PROCESS_LIST_PATH}/${filename}
|
||||||
|
done
|
||||||
|
}
|
||||||
|
rm -rf ${TMP_PROCESS_LIST_PATH}
|
||||||
}
|
}
|
||||||
|
|
||||||
kill_all() {
|
kill_all() {
|
||||||
|
|||||||
Reference in new issue
Block a user