From 83651f92e585d38a7357e4cdbc655a74f87ccc10 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Tue, 19 Nov 2024 01:00:19 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/241693dedf9f2949d008d7a4f0e0e875fe6d9476 --- luci-app-passwall/Makefile | 2 +- .../luasrc/passwall/util_xray.lua | 26 +++++++------------ patch-luci-app-passwall.patch | 2 +- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index 0a0f58adc..a730ee923 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=24.11.18 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 30d56e141..90137784b 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -783,13 +783,15 @@ function gen_config(var) if #valid_nodes == 0 then return nil end -- fallback node + local fallback_node_tag = nil local fallback_node_id = _node.fallback_node - if fallback_node_id == "" then fallback_node_id = nil end + if fallback_node_id == "" or fallback_node_id == "nil" then fallback_node_id = nil end if fallback_node_id then local is_new_node = true for _, outbound in ipairs(outbounds) do - if outbound.tag == fallback_node_id then + if outbound.tag:find("^" .. fallback_node_id) == 1 then is_new_node = false + fallback_node_tag = outbound.tag break end end @@ -800,12 +802,7 @@ function gen_config(var) if outbound then outbound.tag = outbound.tag .. ":" .. fallback_node.remarks table.insert(outbounds, outbound) - else - fallback_node_id = nil - end - else - if not gen_balancer(fallback_node) then - fallback_node_id = nil + fallback_node_tag = outbound.tag end end end @@ -813,10 +810,10 @@ function gen_config(var) table.insert(balancers, { tag = balancer_tag, selector = valid_nodes, - fallbackTag = fallback_node_id, + fallbackTag = fallback_node_tag, strategy = { type = _node.balancingStrategy or "random" } }) - if _node.balancingStrategy == "leastPing" or fallback_node_id then + if _node.balancingStrategy == "leastPing" or fallback_node_tag then if not observatory then observatory = { subjectSelector = { "blc-" }, @@ -1191,13 +1188,8 @@ function gen_config(var) --[[ local default_dns_flag = "remote" - if node_id and tcp_redir_port then - local node = uci:get_all(appname, node_id) - if node.protocol == "_shunt" then - if node.default_node == "_direct" then - default_dns_flag = "direct" - end - end + if (not COMMON.default_balancer_tag and not COMMON.default_outbound_tag) or COMMON.default_outbound_tag == "direct" then + default_dns_flag = "direct" end if dns.servers and #dns.servers > 0 then diff --git a/patch-luci-app-passwall.patch b/patch-luci-app-passwall.patch index e767d998a..757a7bfb2 100644 --- a/patch-luci-app-passwall.patch +++ b/patch-luci-app-passwall.patch @@ -1,5 +1,5 @@ diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile -index 4a14c50..0a0f58a 100644 +index eaa3e9b..a730ee9 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -171,7 +171,6 @@ define Package/$(PKG_NAME)/conffiles