diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 15d67abb..cf9fd5f6 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -1772,15 +1772,22 @@ function gen_config(var) end end end - local dns_block_mode = "host" - dns_block_mode = "" - if dns_block_mode == "host" and dns_outboundTag == "blackhole" then - for d_i, d_k in ipairs(value.domain) do - dns.hosts[d_k] = "0.0.0.0" + local dns_block = true -- If you do not want the blackhole rule to use DNS routing, please change it to `nil` or do not assign a value. + if dns_outboundTag == "blackhole" then + if dns_block then + local dns_block_mode = "Hosts" -- use the Hosts mode to block. + if dns_block_mode == "Hosts" then + for d_i, d_k in ipairs(value.domain) do + dns.hosts[d_k] = "0.0.0.0" + end + dns_server = nil + end + else + dns_server = nil end - dns_server = nil end if dns_server then + dns_server.finalQuery = true dns_server.domains = value.domain if value.shunt_rule_name then dns_server.tag = "dns-in-" .. value.shunt_rule_name