update 2026-09-30 01:29:31

This commit is contained in:
action committed 2026-09-30 01:29:31 +08:00
1 parent cb2fdad301
commit dd96a29afe
176 files changed
+60 -41490

No files matched your search

@@ -357,7 +357,7 @@ if CHNLIST ~= "0" and is_file_nonzero(RULES_PATH .. "/chnlist") then
"add-tagchn-ip" .. ((NFTFLAG == "1") and (" " .. table.concat(sets, ",")) or "")
}
merge_array(config_lines, tmp_lines)
log(string.format(" - 中国域名表(chnroute):%s", DNS_LOCAL or "默认"))
log(string.format(" - 中国域名表(chnlist):%s", DNS_LOCAL or "默认"))
end
--回中国模式
@@ -374,7 +374,7 @@ if CHNLIST ~= "0" and is_file_nonzero(RULES_PATH .. "/chnlist") then
}
if NO_IPV6_TRUST == "1" then table.insert(tmp_lines, "no-ipv6 tag:chn_proxy") end
insert_array_after(config_lines, tmp_lines, "#--1")
log(string.format(" - 中国域名表(chnroute):%s", DNS_TRUST or "默认"))
log(string.format(" - 中国域名表(chnlist):%s", DNS_TRUST or "默认"))
end
end
@@ -552,4 +552,4 @@ if #config_lines > 0 then
end
end
log(" - ChinaDNS-NG已作为Dnsmasq上游,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理域名)分流失效!!!")
log(" - ChinaDNS-NG已作为Dnsmasq上游,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理)分流失效!!!")
@@ -333,19 +333,33 @@ function add_rule(var)
pipe:close()
end
local cache_text = ""
local nodes_address_md5 = sys.exec("echo -n $(uci show passwall | grep '\\.address') | md5sum")
local new_rules = sys.exec("echo -n $(find /usr/share/passwall/rules -type f | xargs md5sum)")
new_rules = new_rules .. sys.exec("echo -n $(find /etc/passwall/rules -type f | xargs md5sum)")
local new_text = TMP_DNSMASQ_PATH .. DNSMASQ_CONF_FILE .. DEFAULT_DNS .. LOCAL_DNS .. TUN_DNS .. USE_DEFAULT_DNS .. CHINADNS_DNS .. USE_DIRECT_LIST .. USE_PROXY_LIST .. USE_BLOCK_LIST .. USE_GFW_LIST .. CHN_LIST .. DEFAULT_PROXY_MODE .. NO_PROXY_IPV6 .. nodes_address_md5 .. new_rules .. NFTFLAG
if fs.access(CACHE_TEXT_FILE) then
for line in io.lines(CACHE_TEXT_FILE) do
cache_text = line
local function get_dns_config_hash()
local nodes_address_md5 = sys.exec([[uci show passwall | grep -E '\.(address|download_address|domain_resolver_dns|domain_resolver_dns_https)=' | cut -d "'" -f 2 | sort -u | md5sum | awk '{printf "%s", $1}']])
local sub_url_md5 = sys.exec([[uci show passwall | grep -E '^passwall\.sub_[^.]+\.url=' | cut -d "'" -f 2 | sort -u | md5sum | awk '{printf "%s", $1}']])
nodes_address_md5 = nodes_address_md5 .. sub_url_md5
local new_rules = sys.exec([[
for f in \
/usr/share/passwall/rules/chnlist \
/usr/share/passwall/rules/gfwlist \
/etc/passwall/rules/direct_host \
/etc/passwall/rules/proxy_host \
/etc/passwall/rules/block_host
do
[ -f "$f" ] && md5sum "$f" | awk '{printf "%s", $1}'
done
]])
local SHUNT_LIST = ""
if IS_SHUNT_NODE then
local t = api.uci_get_c(NODE)
api.uci_foreach_c("shunt_rules", function(s)
local _node_id = t[s[".name"]]
if _node_id and _node_id ~= "_blackhole" and t["shunt_group"] == s.group then
SHUNT_LIST = SHUNT_LIST .. (s.domain_list or "") .. _node_id
end
end)
end
end
if cache_text ~= new_text then
api.remove(CACHE_DNS_PATH .. "*")
new_rules = new_rules .. sys.exec("printf '%s' " .. api.base64Encode(SHUNT_LIST) .. " | md5sum | awk '{printf \"%s\", $1}'")
return TMP_DNSMASQ_PATH .. DNSMASQ_CONF_FILE .. DEFAULT_DNS .. LOCAL_DNS .. TUN_DNS .. USE_DEFAULT_DNS .. CHINADNS_DNS .. USE_DIRECT_LIST .. USE_PROXY_LIST .. USE_BLOCK_LIST .. USE_GFW_LIST .. CHN_LIST .. DEFAULT_PROXY_MODE .. NO_PROXY_IPV6 .. nodes_address_md5 .. new_rules .. NFTFLAG
end
local dnsmasq_default_dns
@@ -375,6 +389,22 @@ function add_rule(var)
local setflag_4= (NFTFLAG == "1") and "4#inet#passwall#" or ""
local setflag_6= (NFTFLAG == "1") and "6#inet#passwall#" or ""
local new_text = ""
if USE_CHINADNS_NG == "0" then
local cache_text = ""
if fs.access(CACHE_TEXT_FILE) then
for line in io.lines(CACHE_TEXT_FILE) do
cache_text = line
end
end
new_text = get_dns_config_hash()
if cache_text ~= new_text then
api.remove(CACHE_DNS_PATH .. "*")
end
else
api.remove(CACHE_DNS_PATH .. "*")
end
if not fs.access(CACHE_DNS_PATH) then
fs.mkdir(CACHE_DNS_PATH)
@@ -621,7 +651,7 @@ function add_rule(var)
end
end
f:close()
log(string.format(" - 中国域名表(chnroute):%s", fwd_dns or "默认"))
log(string.format(" - 中国域名表(chnlist):%s", fwd_dns or "默认"))
end
end
end
@@ -763,6 +793,8 @@ function add_rule(var)
local f_out = io.open(CACHE_TEXT_FILE, "a")
f_out:write(new_text)
f_out:close()
else
log(" - 从缓存加载 Dnsmasq 域名分流规则。")
end
if USE_CHINADNS_NG == "0" then
@@ -811,7 +843,7 @@ function add_rule(var)
end
if USE_CHINADNS_NG == "0" then
log(" - PassWall必须依赖于Dnsmasq,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理域名)分流失效!!!")
log(" - PassWall必须依赖于Dnsmasq,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理)分流失效!!!")
end
end
@@ -523,7 +523,7 @@ if CHN_LIST ~= "0" and is_file_nonzero(RULES_PATH .. "/chnlist") then
domain_rules_str = domain_rules_str .. (LOCAL_EXTEND_ARG ~= "" and " " .. LOCAL_EXTEND_ARG or "")
table.insert(tmp_lines, domain_rules_str)
insert_array_after(config_lines, tmp_lines, "#--2")
log(string.format(" - 中国域名表(chnroute)使用分组:%s", LOCAL_GROUP or "默认"))
log(string.format(" - 中国域名表(chnlist)使用分组:%s", LOCAL_GROUP or "默认"))
end
--回中国模式
@@ -542,7 +542,7 @@ if CHN_LIST ~= "0" and is_file_nonzero(RULES_PATH .. "/chnlist") then
end
table.insert(tmp_lines, domain_rules_str)
insert_array_after(config_lines, tmp_lines, "#--2")
log(string.format(" - 中国域名表(chnroute)使用分组:%s", REMOTE_GROUP or "默认"))
log(string.format(" - 中国域名表(chnlist)使用分组:%s", REMOTE_GROUP or "默认"))
end
end
@@ -694,4 +694,4 @@ 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流程,将会导致域名(直连/代理域名)分流失效!!!")
log(" - SmartDNS已作为Dnsmasq上游,如果你自行配置了错误的DNS流程,将会导致域名(直连/代理)分流失效!!!")
@@ -2255,7 +2255,7 @@ local execute = function()
f:close()
local raw_data = api.trim(stdout)
local old_md5 = value.md5 or ""
local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{print $1}'"):gsub("\n", "")
local new_md5 = luci.sys.exec("md5sum " .. tmp_file .. " 2>/dev/null | awk '{printf \"%s\", $1}'")
if not manual_sub and old_md5 == new_md5 then
log('订阅:【' .. remark .. '】没有变化,无需更新。')
else