🐤 Sync 2026-08-14 17:37:24

This commit is contained in:
github-actions[bot] committed 2026-08-14 17:37:24 +08:00
1 parent 706ba9bda3
commit badefb504c
85 files changed
+2298 -2242

No files matched your search

@@ -21,11 +21,11 @@ local haproxy_conf = var["-conf"]
local haproxy_dns = "127.0.0.1"
local cpu_thread = sys.exec('echo -n $(cat /proc/cpuinfo | grep "processor" | wc -l)') or "1"
local health_check_type = uci:get(appname, "@global_haproxy[0]", "health_check_type") or "tcp"
local health_check_inter = uci:get(appname, "@global_haproxy[0]", "health_check_inter") or "20"
local balancingStrategy = uci:get(appname, "@global_haproxy[0]", "balancingStrategy") or "roundrobin"
local console_port = uci:get(appname, "@global_haproxy[0]", "console_port")
local bind_local = uci:get(appname, "@global_haproxy[0]", "bind_local") or "0"
local health_check_type = uci:get(api.c_config, "@global_haproxy[0]", "health_check_type") or "tcp"
local health_check_inter = uci:get(api.c_config, "@global_haproxy[0]", "health_check_inter") or "20"
local balancingStrategy = uci:get(api.c_config, "@global_haproxy[0]", "balancingStrategy") or "roundrobin"
local console_port = uci:get(api.c_config, "@global_haproxy[0]", "console_port")
local bind_local = uci:get(api.c_config, "@global_haproxy[0]", "bind_local") or "0"
local bind_address = "0.0.0.0"
if bind_local == "1" then bind_address = "127.0.0.1" end
@@ -92,15 +92,15 @@ f_out:write(haproxy_config)
local listens = {}
uci:foreach(appname, "haproxy_config", function(t)
uci:foreach(api.c_config, "haproxy_config", function(t)
if t.enabled == "1" then
local server_remark
local server_address
local server_port
local lbss = t.lbss
local listen_port = tonumber(t.haproxy_port) or 0
local server_node = uci:get_all(appname, lbss)
local hop = (health_check_type == "passwall_logic") and (server_node.hysteria_hop or server_node.hysteria2_hop) or nil
local server_node = uci:get_all(api.c_config, lbss)
local hop = (health_check_type == "script_logic") and (server_node.hysteria_hop or server_node.hysteria2_hop) or nil
hop = hop and hop:gsub(":", "-") or nil
if server_node and server_node.address and (server_node.port or hop) then
server_remark = server_node.address .. ":" .. (server_node.port or hop)
@@ -108,7 +108,7 @@ uci:foreach(appname, "haproxy_config", function(t)
server_port = server_node.port or hop
t.origin_address = server_address
t.origin_port = server_port
if health_check_type == "passwall_logic" then
if health_check_type == "script_logic" then
if server_node.type ~= "Socks" then
local relay_port = server_node.port
local new_port = api.get_new_port()
@@ -170,7 +170,7 @@ listen %s
balance %s
]], port, bind_address, port, balancingStrategy))
if health_check_type == "passwall_logic" then
if health_check_type == "script_logic" then
f_out:write(string.format([[
option external-check
external-check command "/usr/share/%s/haproxy_check.sh"
@@ -212,8 +212,8 @@ listen %s
end
-- Console config
local console_user = uci:get(appname, "@global_haproxy[0]", "console_user")
local console_password = uci:get(appname, "@global_haproxy[0]", "console_password")
local console_user = uci:get(api.c_config, "@global_haproxy[0]", "console_user")
local console_password = uci:get(api.c_config, "@global_haproxy[0]", "console_password")
local str = [[
listen console
bind 0.0.0.0:%s
@@ -228,8 +228,8 @@ f_out:write("\n" .. string.format(str, console_port, (console_user and console_u
f_out:close()
-- Built-in health check URL
if health_check_type == "passwall_logic" then
local probeUrl = uci:get(appname, "@global_haproxy[0]", "health_probe_url") or "https://www.google.com/generate_204"
if health_check_type == "script_logic" then
local probeUrl = uci:get(api.c_config, "@global_haproxy[0]", "health_probe_url") or "https://www.google.com/generate_204"
local f_url = io.open(haproxy_path .. "/Probe_URL", "w")
f_url:write(probeUrl)
f_url:close()