luci-app-passwall: sync upstream

last commit: dae13c86a4
This commit is contained in:
gitea-action 2025-03-29 13:00:23 +08:00
parent 5a70ec642f
commit 9cf6ba7bb0
3 changed files with 46 additions and 16 deletions

View File

@ -95,7 +95,7 @@ m.uci:foreach(appname, "socks", function(s)
end) end)
-- 负载均衡列表 -- 负载均衡列表
local o = s:option(DynamicList, _n("balancing_node"), translate("Load balancing node list"), translate("Load balancing node list, <a target='_blank' href='https://toutyrater.github.io/routing/balance2.html'>document</a>")) local o = s:option(DynamicList, _n("balancing_node"), translate("Load balancing node list"), translate("Load balancing node list, <a target='_blank' href='https://xtls.github.io/config/routing.html#balancerobject'>document</a>"))
o:depends({ [_n("protocol")] = "_balancing" }) o:depends({ [_n("protocol")] = "_balancing" })
for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end
@ -104,7 +104,8 @@ o:depends({ [_n("protocol")] = "_balancing" })
o:value("random") o:value("random")
o:value("roundRobin") o:value("roundRobin")
o:value("leastPing") o:value("leastPing")
o.default = "leastPing" o:value("leastLoad")
o.default = "leastLoad"
-- Fallback Node -- Fallback Node
if api.compare_versions(xray_version, ">=", "1.8.10") then if api.compare_versions(xray_version, ">=", "1.8.10") then
@ -133,6 +134,7 @@ end
-- 探测地址 -- 探测地址
local ucpu = s:option(Flag, _n("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.")) local ucpu = s:option(Flag, _n("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."))
ucpu:depends({ [_n("balancingStrategy")] = "leastPing" }) ucpu:depends({ [_n("balancingStrategy")] = "leastPing" })
ucpu:depends({ [_n("balancingStrategy")] = "leastLoad" })
local pu = s:option(Value, _n("probeUrl"), translate("Probe URL")) local pu = s:option(Value, _n("probeUrl"), translate("Probe URL"))
pu:depends({ [_n("useCustomProbeUrl")] = true }) pu:depends({ [_n("useCustomProbeUrl")] = true })
@ -148,8 +150,9 @@ pu.description = translate("The URL used to detect the connection status.")
-- 探测间隔 -- 探测间隔
local pi = s:option(Value, _n("probeInterval"), translate("Probe Interval")) local pi = s:option(Value, _n("probeInterval"), translate("Probe Interval"))
pi:depends({ [_n("balancingStrategy")] = "leastPing" }) pi:depends({ [_n("balancingStrategy")] = "leastPing" })
pi:depends({ [_n("balancingStrategy")] = "leastLoad" })
pi.default = "1m" pi.default = "1m"
pi.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 <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.") pi.description = translate("The interval between initiating probes. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively.")
if api.compare_versions(xray_version, ">=", "1.8.12") then if api.compare_versions(xray_version, ">=", "1.8.12") then
ucpu:depends({ [_n("protocol")] = "_balancing" }) ucpu:depends({ [_n("protocol")] = "_balancing" })
@ -159,6 +162,12 @@ else
pi:depends({ [_n("balancingStrategy")] = "leastPing" }) pi:depends({ [_n("balancingStrategy")] = "leastPing" })
end end
o = s:option(Value, _n("expected"), translate("Preferred Node Count"))
o:depends({ [_n("balancingStrategy")] = "leastLoad" })
o.datatype = "uinteger"
o.default = "2"
o.description = translate("The load balancer selects the optimal number of nodes, and traffic is randomly distributed among them.")
-- [[ 分流模块 ]] -- [[ 分流模块 ]]
if #nodes_table > 0 then if #nodes_table > 0 then

View File

@ -581,7 +581,8 @@ function gen_config(var)
local dns = nil local dns = nil
local fakedns = nil local fakedns = nil
local routing = nil local routing = nil
local observatory = nil local burstObservatory = nil
local strategy = nil
local inbounds = {} local inbounds = {}
local outbounds = {} local outbounds = {}
local COMMON = {} local COMMON = {}
@ -761,19 +762,33 @@ function gen_config(var)
end end
end end
end end
if _node.balancingStrategy == "leastLoad" then
strategy = {
type = _node.balancingStrategy,
settings = {
expected = _node.expected and tonumber(_node.expected) and tonumber(_node.expected) or 2,
maxRTT = "1s"
}
}
else
strategy = { type = _node.balancingStrategy or "random" }
end
table.insert(balancers, { table.insert(balancers, {
tag = balancer_tag, tag = balancer_tag,
selector = valid_nodes, selector = valid_nodes,
fallbackTag = fallback_node_tag, fallbackTag = fallback_node_tag,
strategy = { type = _node.balancingStrategy or "random" } strategy = strategy
}) })
if _node.balancingStrategy == "leastPing" or fallback_node_tag then if _node.balancingStrategy == "leastPing" or _node.balancingStrategy == "leastLoad" or fallback_node_tag then
if not observatory then if not burstObservatory then
observatory = { burstObservatory = {
subjectSelector = { "blc-" }, subjectSelector = { "blc-" },
probeUrl = _node.useCustomProbeUrl and _node.probeUrl or nil, pingConfig = {
probeInterval = _node.probeInterval or "1m", destination = _node.useCustomProbeUrl and _node.probeUrl or nil,
enableConcurrency = true interval = _node.probeInterval or "1m",
sampling = 3,
timeout = "5s"
}
} }
end end
end end
@ -1358,7 +1373,7 @@ function gen_config(var)
-- 传出连接 -- 传出连接
outbounds = outbounds, outbounds = outbounds,
-- 连接观测 -- 连接观测
observatory = observatory, burstObservatory = burstObservatory,
-- 路由 -- 路由
routing = routing, routing = routing,
-- 本地策略 -- 本地策略

View File

@ -445,8 +445,14 @@ msgstr "用于检测连接状态的网址。"
msgid "Probe Interval" msgid "Probe Interval"
msgstr "探测间隔" msgstr "探测间隔"
msgid "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 <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively." msgid "The interval between initiating probes. The time format is numbers + units, such as '10s', '2h45m', and the supported time units are <code>ns</code>, <code>us</code>, <code>ms</code>, <code>s</code>, <code>m</code>, <code>h</code>, which correspond to nanoseconds, microseconds, milliseconds, seconds, minutes, and hours, respectively."
msgstr "发起探测的间隔。每经过这个时间,就会对一个服务器进行服务器状态检测。时间格式为数字+单位,比如<code>&quot;10s&quot;</code>, <code>&quot;2h45m&quot;</code>,支持的时间单位有 <code>ns</code><code>us</code><code>ms</code><code>s</code><code>m</code><code>h</code>,分别对应纳秒、微秒、毫秒、秒、分、时。" msgstr "发起探测的间隔。时间格式为数字+单位,比如<code>&quot;10s&quot;</code>, <code>&quot;2h45m&quot;</code>,支持的时间单位有 <code>ns</code><code>us</code><code>ms</code><code>s</code><code>m</code><code>h</code>,分别对应纳秒、微秒、毫秒、秒、分、时。"
msgid "Preferred Node Count"
msgstr "优选节点数量"
msgid "The load balancer selects the optimal number of nodes, and traffic is randomly distributed among them."
msgstr "负载均衡器选出最优节点的个数,流量将在这几个节点中随机分配。"
msgid "Shunt" msgid "Shunt"
msgstr "分流" msgstr "分流"
@ -508,8 +514,8 @@ msgstr "仅 IPv6"
msgid "Load balancing node list" msgid "Load balancing node list"
msgstr "负载均衡节点列表" msgstr "负载均衡节点列表"
msgid "Load balancing node list, <a target='_blank' href='https://toutyrater.github.io/routing/balance2.html'>document</a>" msgid "Load balancing node list, <a target='_blank' href='https://xtls.github.io/config/routing.html#balancerobject'>document</a>"
msgstr "负载均衡节点列表,<a target='_blank' href='https://toutyrater.github.io/routing/balance2.html'>文档原理</a>" msgstr "负载均衡节点列表,<a target='_blank' href='https://xtls.github.io/config/routing.html#balancerobject'>文档原理</a>"
msgid "From Share URL" msgid "From Share URL"
msgstr "导入分享URL" msgstr "导入分享URL"