luci-app-passwall: sync upstream

last commit: 419af4561d
This commit is contained in:
gitea-action 2025-05-08 22:00:21 +08:00
parent d83dfa27b1
commit 029f48c7ca
3 changed files with 18 additions and 9 deletions

View File

@ -6,7 +6,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall PKG_NAME:=luci-app-passwall
PKG_VERSION:=25.5.2 PKG_VERSION:=25.5.8
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \

View File

@ -93,7 +93,7 @@ string.gsub(haproxy_dns, '[^' .. "," .. ']+', function(w)
if not s:find(":") then if not s:find(":") then
s = s .. ":53" s = s .. ":53"
end 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) end)
haproxy_config = haproxy_config:gsub("{{dns}}", mydns) haproxy_config = haproxy_config:gsub("{{dns}}", mydns)
@ -180,22 +180,31 @@ listen %s
]], port, port)) ]], port, port))
end end
local count_M, count_B = 1, 1
for i, o in ipairs(listens[port]) do 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 = o.server_address .. ":" .. o.server_port
local server_conf = "server {{remark}} {{server}} weight {{weight}} {{resolvers}} check inter {{inter}} rise 1 fall 3 {{backup}}" 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("{{remark}}", remark)
server_conf = server_conf:gsub("{{server}}", server) 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" local resolvers = "resolvers mydns"
if api.is_ip(o.server_address) then if api.is_ip(o.server_address) then
resolvers = "" resolvers = ""
end end
server_conf = server_conf:gsub("{{resolvers}}", resolvers) server_conf = server_conf:gsub("{{resolvers}}", resolvers)
server_conf = server_conf:gsub("{{inter}}", tonumber(health_check_inter) .. "s") 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("{{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 if o.export ~= "0" then
sys.call(string.format("/usr/share/passwall/app.sh add_ip2route %s %s", o.origin_address, o.export)) sys.call(string.format("/usr/share/passwall/app.sh add_ip2route %s %s", o.origin_address, o.export))

View File

@ -1,5 +1,5 @@
diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile diff --git a/luci-app-passwall/Makefile b/luci-app-passwall/Makefile
index b0a2282..bab556b 100644 index 184c14a..2185060 100644
--- a/luci-app-passwall/Makefile --- a/luci-app-passwall/Makefile
+++ b/luci-app-passwall/Makefile +++ b/luci-app-passwall/Makefile
@@ -67,7 +67,7 @@ config PACKAGE_$(PKG_NAME)_Nftables_Transparent_Proxy @@ -67,7 +67,7 @@ config PACKAGE_$(PKG_NAME)_Nftables_Transparent_Proxy