From 3114e522470785b0a0721501b9ef6ff8d679ae87 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Tue, 19 Nov 2024 00:30:32 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall2/commit/99ab1417e51e1570f5d64524ba24ed43dc8113a1 --- luci-app-passwall2/Makefile | 2 +- .../luasrc/passwall2/util_xray.lua | 19 ++++++++----------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/luci-app-passwall2/Makefile b/luci-app-passwall2/Makefile index 52ec5c668..ee7af1f0b 100644 --- a/luci-app-passwall2/Makefile +++ b/luci-app-passwall2/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall2 PKG_VERSION:=24.11.18 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_CONFIG_DEPENDS:= \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index b482126ac..c047c8ec5 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -781,13 +781,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 @@ -798,12 +800,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 @@ -811,10 +808,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-" }, @@ -1366,7 +1363,7 @@ function gen_config(var) end local default_dns_flag = "remote" - if not COMMON.default_outbound_tag or COMMON.default_outbound_tag == "direct" then + if (not COMMON.default_balancer_tag and COMMON.default_balancer_tag) or COMMON.default_outbound_tag == "direct" then default_dns_flag = "direct" end