mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-06 11:24:15 +08:00
update 2026-10-12 01:13:21
This commit is contained in:
1 parent
6f8f22eee4
commit
5ece75ecfd
7 files changed
+46635
-283280
No files matched your search
@@ -23,6 +23,7 @@ local NFTFLAG = var["-NFTFLAG"]
|
||||
local SUBNET = var["-SUBNET"]
|
||||
local LISTEN_PORT = var["-LISTEN_PORT"]
|
||||
local LOCAL_PORT = var["-LOCAL_PORT"]
|
||||
local DNS_REDIRECT = var["-DNS_REDIRECT"] == "1"
|
||||
|
||||
local sys = api.sys
|
||||
local fs = api.fs
|
||||
@@ -185,14 +186,26 @@ end
|
||||
|
||||
local force_https_soa = api.uci_get_c("@global[0]", "force_https_soa") or 0
|
||||
local proxy_server_name = "psw-proxy-server"
|
||||
local listen_address = "[::]:" .. LISTEN_PORT .. (DNS_REDIRECT and "" or "@lo")
|
||||
local local_domain = DNS_REDIRECT and api.uci_get("dhcp", "@dnsmasq[0]", "domain")
|
||||
config_lines = {
|
||||
tonumber(LISTEN_PORT) ~= 0 and "bind [::]:" .. LISTEN_PORT .. "@lo" or "",
|
||||
tonumber(LISTEN_PORT) ~= 0 and "bind " .. listen_address or "",
|
||||
tonumber(LISTEN_PORT) ~= 0 and "bind-tcp " .. listen_address or "",
|
||||
(tonumber(LOCAL_PORT) ~= 0 and LOCAL_GROUP) and "bind [::]:" .. LOCAL_PORT .. "@lo -group " .. LOCAL_GROUP or "",
|
||||
(tonumber(LOCAL_PORT) ~= 0 and LOCAL_GROUP) and "bind-tcp [::]:" .. LOCAL_PORT .. "@lo -group " .. LOCAL_GROUP or "",
|
||||
tonumber(force_https_soa) == 1 and "force-qtype-SOA 65" or "force-qtype-SOA -,65",
|
||||
"server 223.5.5.5 -bootstrap-dns",
|
||||
-- Set the suffix before loading hosts/leases so initial records are expanded too.
|
||||
(local_domain and local_domain ~= "") and "local-domain " .. local_domain or "",
|
||||
is_file_nonzero("/etc/hosts") and "hosts-file /etc/hosts" or "",
|
||||
DNS_MODE == "socks" and string.format("proxy-server socks5://%s -name %s", REMOTE_PROXY_SERVER, proxy_server_name) or ""
|
||||
}
|
||||
if DNS_REDIRECT then
|
||||
-- SmartDNS monitors the lease file and updates local records without a restart.
|
||||
local lease_file = api.uci_get("dhcp", "@dnsmasq[0]", "leasefile")
|
||||
if not lease_file or lease_file == "" then lease_file = "/tmp/dhcp.leases" end
|
||||
table.insert(config_lines, string.format("dnsmasq-lease-file %q", lease_file))
|
||||
end
|
||||
if DNS_MODE == "socks" then
|
||||
for w in string.gmatch(REMOTE_DNS, '[^|]+') do
|
||||
local server_dns = api.trim(w)
|
||||
@@ -632,7 +645,9 @@ if IS_SHUNT_NODE and not only_global then
|
||||
|
||||
SHUNT_LIST = SHUNT_LIST .. domain_list .. (_node_id:sub(1, 1) == "_" and "not-node" or "node")
|
||||
|
||||
log(string.format(" - Sing-Box/Xray分流规则(%s)使用分组:%s", s.remarks, REMOTE_GROUP or "默认"))
|
||||
if _node_id ~= "_direct" and _node_id ~= "_blackhole" then
|
||||
log(string.format(" - Sing-Box/Xray分流规则(%s)使用分组:%s", s.remarks, REMOTE_GROUP or "默认"))
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -770,4 +785,8 @@ end
|
||||
|
||||
fs.symlink(TMP_CONF_FILE, SMARTDNS_CONF)
|
||||
sys.call(string.format('echo "conf-file %s" >> /etc/smartdns/custom.conf', string.gsub(SMARTDNS_CONF, "passwall", "passwall*")))
|
||||
log(" - SmartDNS已作为Dnsmasq上游,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理)分流失效!!!")
|
||||
if DNS_REDIRECT then
|
||||
log(" - DNS 重定向直接使用 SmartDNS,DHCP 租约由 SmartDNS 自动加载。")
|
||||
else
|
||||
log(" - SmartDNS已作为Dnsmasq上游,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理)分流失效!!!")
|
||||
end
|
||||
Reference in new issue
Block a user