From 037fad579c84a49dc6d1a631cb40687f53d88391 Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Mon, 26 Feb 2024 21:44:20 +0800 Subject: [PATCH] luci: add Xray v1.8.8 balancer leastLoad strategy --- .../luasrc/model/cbi/passwall/client/type/ray.lua | 5 ++++- luci-app-passwall/luasrc/passwall/util_xray.lua | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index d0055a11a..99bf43633 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -81,11 +81,13 @@ local o = s:option(ListValue, option_name("balancingStrategy"), translate("Balan o:depends({ [option_name("protocol")] = "_balancing" }) o:value("random") o:value("leastPing") -o.default = "random" +o:value("leastLoad") +o.default = "leastLoad" -- 探测地址 local o = s:option(Flag, option_name("useCustomProbeUrl"), translate("Use Custome Probe URL"), translate("By default the built-in probe URL will be used, enable this option to use a custom probe URL.")) o:depends({ [option_name("balancingStrategy")] = "leastPing" }) +o:depends({ [option_name("balancingStrategy")] = "leastLoad" }) local o = s:option(Value, option_name("probeUrl"), translate("Probe URL")) o:depends({ [option_name("useCustomProbeUrl")] = true }) @@ -95,6 +97,7 @@ o.description = translate("The URL used to detect the connection status.") -- 探测间隔 local o = s:option(Value, option_name("probeInterval"), translate("Probe Interval")) o:depends({ [option_name("balancingStrategy")] = "leastPing" }) +o:depends({ [option_name("balancingStrategy")] = "leastLoad" }) o.default = "1m" o.description = translate("The interval between initiating probes. Every time this time elapses, a server status check is performed on a server. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are ns, us, ms, s, m, h, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.") diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 04c6b03fc..7e8ba6d5a 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -670,7 +670,7 @@ function gen_config(var) selector = valid_nodes, strategy = { type = _node.balancingStrategy or "random" } } - if _node.balancingStrategy == "leastPing" then + if _node.balancingStrategy == "leastPing" or _node.balancingStrategy == "leastLoad" then if not observatory then observatory = { subjectSelector = { "blc-" },