From cd923c99cc877c0c35d8d6194ef087b43a0e43af Mon Sep 17 00:00:00 2001 From: gitea-action Date: Mon, 28 Apr 2025 16:00:25 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/031adb7a24950f509655c1ba94830f071ad24a77 --- .../luasrc/passwall/util_sing-box.lua | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index a411e0a8d..38cb7bc9a 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -130,13 +130,10 @@ function gen_outbound(flag, node, tag, proxy_table) if version_ge_1_12_0 then --https://sing-box.sagernet.org/migration/#migrate-outbound-domain-strategy-option-to-domain-resolver result.domain_strategy = nil - if node.domain_strategy then - local domain_resolver = { - server = "direct", - strategy = node.domain_strategy - } - result.domain_resolver = domain_resolver - end + result.domain_resolver = { + server = "direct", + strategy = (node.domain_strategy and node.domain_strategy ~="") and node.domain_strategy or nil + } end local tls = nil @@ -1762,6 +1759,23 @@ function gen_config(var) strategy = "prefer_ipv6" } direct_outbound.domain_resolver = domain_resolver + -- 当没有 direct dns 服务器时添加 local + if config.dns and config.dns.servers then + for _, server in ipairs(config.dns.servers) do + if server.tag == "direct" then + break + end + end + else + config.dns = { + servers = { + { + type = "local", + tag = "direct" + } + }, + } + end end table.insert(outbounds,direct_outbound)