luci: update chinadns-ng logic

Follow the new feature upgrade.
This commit is contained in:
xiaorouji 2023-04-21 13:45:38 +08:00 committed by sbwml
parent cae9a39230
commit 61b45025ca
2 changed files with 21 additions and 16 deletions

View File

@ -423,7 +423,7 @@ run_chinadns_ng() {
([ -n "$_chnlist" ] || [ -n "$_gfwlist" ]) && [ -s "${RULES_PATH}/gfwlist" ] && {
local _gfwlist_file="${TMP_PATH}/chinadns_gfwlist"
cp -a "${RULES_PATH}/gfwlist" "${_gfwlist_file}"
_extra_param="${_extra_param} -g ${_gfwlist_file}"
_extra_param="${_extra_param} -g ${_gfwlist_file} -A gfwlist,gfwlist6"
#当只有使用gfwlist模式时设置默认DNS为本地直连
[ -n "$_gfwlist" ] && [ -z "$_chnlist" ] && _default_tag="chn"
}

View File

@ -291,24 +291,29 @@ if not fs.access(CACHE_DNS_PATH) then
--如果没有使用回国模式
if not returnhome then
if fs.access("/usr/share/passwall/rules/gfwlist") then
local gfwlist_str = sys.exec('cat /usr/share/passwall/rules/gfwlist | grep -v -E "^#" | grep -v -E "' .. excluded_domain_str .. '"')
for line in string.gmatch(gfwlist_str, "[^\r\n]+") do
if line ~= "" then
local ipset_flag = setflag_4 .. "gfwlist," .. setflag_6 .. "gfwlist6"
if NO_PROXY_IPV6 == "1" then
ipset_flag = setflag_4 .. "gfwlist"
set_domain_address(line, "::")
fwd_dns = TUN_DNS
if CHNROUTE_MODE_DEFAULT_DNS == "chinadns_ng" and CHINADNS_DNS ~= "0" then
fwd_dns = nil
else
local ipset_flag = setflag_4 .. "gfwlist," .. setflag_6 .. "gfwlist6"
if NO_PROXY_IPV6 == "1" then
ipset_flag = setflag_4 .. "gfwlist"
end
if not only_global then
if REMOTE_FAKEDNS == "1" then
ipset_flag = nil
end
if not only_global then
fwd_dns = TUN_DNS
if CHNROUTE_MODE_DEFAULT_DNS == "chinadns_ng" and CHINADNS_DNS ~= "0" then
fwd_dns = nil
end
local gfwlist_str = sys.exec('cat /usr/share/passwall/rules/gfwlist | grep -v -E "^#" | grep -v -E "' .. excluded_domain_str .. '"')
for line in string.gmatch(gfwlist_str, "[^\r\n]+") do
if line ~= "" then
if NO_PROXY_IPV6 == "1" then
set_domain_address(line, "::")
end
if REMOTE_FAKEDNS == "1" then
ipset_flag = nil
if not only_global then
set_domain_dns(line, fwd_dns)
set_domain_ipset(line, ipset_flag)
end
set_domain_dns(line, fwd_dns)
set_domain_ipset(line, ipset_flag)
end
end
end