From 13f0fbebd0248ceacc72ec28e859008a42abc59a Mon Sep 17 00:00:00 2001 From: kenzok8 Date: Fri, 9 May 2025 00:28:33 +0800 Subject: [PATCH] update 2025-05-09 00:28:33 --- luci-app-passwall/Makefile | 2 +- .../root/usr/share/passwall/haproxy.lua | 23 +++++++++++++------ natflow/Makefile | 4 ++-- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile index b0a2282f0..184c14a77 100644 --- a/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall -PKG_VERSION:=25.5.2 +PKG_VERSION:=25.5.8 PKG_RELEASE:=1 PKG_CONFIG_DEPENDS:= \ diff --git a/luci-app-passwall/root/usr/share/passwall/haproxy.lua b/luci-app-passwall/root/usr/share/passwall/haproxy.lua index 67366ae1f..ae7730171 100644 --- a/luci-app-passwall/root/usr/share/passwall/haproxy.lua +++ b/luci-app-passwall/root/usr/share/passwall/haproxy.lua @@ -93,7 +93,7 @@ string.gsub(haproxy_dns, '[^' .. "," .. ']+', function(w) if not s:find(":") then s = s .. ":53" end - mydns = mydns .. (index > 1 and "\n" or "") .. " " .. string.format("nameserver dns%s %s", index, s) + mydns = mydns .. (index > 1 and "\n" or "") .. " " .. string.format("nameserver dns%s %s", index, s) end) haproxy_config = haproxy_config:gsub("{{dns}}", mydns) @@ -180,22 +180,31 @@ listen %s ]], port, port)) end + local count_M, count_B = 1, 1 for i, o in ipairs(listens[port]) do - local remark = o.server_remark + local remark = o.server_remark or "" + -- 防止重名导致无法运行 + if tostring(o.backup) ~= "1" then + remark = "M" .. count_M .. "-" .. remark + count_M = count_M + 1 + else + remark = "B" .. count_B .. "-" .. remark + count_B = count_B + 1 + end local server = o.server_address .. ":" .. o.server_port local server_conf = "server {{remark}} {{server}} weight {{weight}} {{resolvers}} check inter {{inter}} rise 1 fall 3 {{backup}}" server_conf = server_conf:gsub("{{remark}}", remark) server_conf = server_conf:gsub("{{server}}", server) - server_conf = server_conf:gsub("{{weight}}", o.lbweight) + server_conf = server_conf:gsub("{{weight}}", o.lbweight) local resolvers = "resolvers mydns" if api.is_ip(o.server_address) then resolvers = "" end - server_conf = server_conf:gsub("{{resolvers}}", resolvers) - server_conf = server_conf:gsub("{{inter}}", tonumber(health_check_inter) .. "s") - server_conf = server_conf:gsub("{{backup}}", o.backup == "1" and "backup" or "") + server_conf = server_conf:gsub("{{resolvers}}", resolvers) + server_conf = server_conf:gsub("{{inter}}", tonumber(health_check_inter) .. "s") + server_conf = server_conf:gsub("{{backup}}", tostring(o.backup) == "1" and "backup" or "") - f_out:write(" " .. server_conf .. "\n") + f_out:write(" " .. server_conf .. "\n") if o.export ~= "0" then sys.call(string.format("/usr/share/passwall/app.sh add_ip2route %s %s", o.origin_address, o.export)) diff --git a/natflow/Makefile b/natflow/Makefile index 396cfc14d..1212fafda 100644 --- a/natflow/Makefile +++ b/natflow/Makefile @@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=natflow -PKG_VERSION:=20250505 +PKG_VERSION:=20250508 PKG_SOURCE_URL:=https://codeload.github.com/ptpt52/natflow/tar.gz/$(PKG_VERSION)? -PKG_HASH:=33b58db109fef50282b15cde028a397ff6dbf940d7c26f6418eec511796efebd +PKG_HASH:=3379bc94881921ccbec11b1ad127defe5e5814fd36c1e44ca69663b6b5d1d2f8 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_MAINTAINER:=Chen Minqiang