From 9ce7d88ee2859cc0e6b16ea87d86f9ddfb51240d Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Wed, 13 Sep 2023 21:42:19 +0800 Subject: [PATCH] luci: fix the bug that may be triggered --- luci-app-passwall/luasrc/passwall/util_sing-box.lua | 6 ++++-- luci-app-passwall/luasrc/passwall/util_xray.lua | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index a93ace433..a5b42d6af 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -1233,14 +1233,16 @@ function gen_config(var) end local direct_rule = { server = dns_tag, - domain = domain, + domain = #domain > 0 and domain or nil, domain_suffix = #domain_suffix > 0 and domain_suffix or nil, domain_keyword = #domain_keyword > 0 and domain_keyword or nil, domain_regex = #domain_regex > 0 and domain_regex or nil, geosite = #geosite > 0 and geosite or nil, disable_cache = false, } - table.insert(dns.rules, direct_rule) + if direct_rule.domain or direct_rule.domain_suffix or direct_rule.domain_keyword or direct_rule.domain_regex or direct_rule.geosite then + table.insert(dns.rules, direct_rule) + end local direct_strategy = "prefer_ipv6" if direct_dns_query_strategy == "UseIPv4" then diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index d3d84b267..c820915bf 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -1036,6 +1036,7 @@ function gen_config(var) address = remote_dns_server, port = (_remote_dns_proto ~= "doh" and tonumber(remote_dns_port)) and tonumber(remote_dns_port) or 53, network = "tcp", + nonIPQuery = (_remote_dns_proto == "tcp") and "skip" or "drop" } })