mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-02 04:23:56 +08:00
💋 Sync 2026-04-01 23:56:48
This commit is contained in:
1 parent
82407ad322
commit
66079c2f8f
1 file changed
+22
-8
@@ -746,6 +746,7 @@ function gen_config(var)
|
|||||||
local fakedns = nil
|
local fakedns = nil
|
||||||
local routing = nil
|
local routing = nil
|
||||||
local observatory = nil
|
local observatory = nil
|
||||||
|
local burstObservatory = nil
|
||||||
local strategy = nil
|
local strategy = nil
|
||||||
local inbounds = {}
|
local inbounds = {}
|
||||||
local outbounds = {}
|
local outbounds = {}
|
||||||
@@ -1003,19 +1004,31 @@ function gen_config(var)
|
|||||||
fallbackTag = fallback_node_tag,
|
fallbackTag = fallback_node_tag,
|
||||||
strategy = strategy
|
strategy = strategy
|
||||||
})
|
})
|
||||||
if not observatory and (_node.balancingStrategy == "leastPing" or _node.balancingStrategy == "leastLoad" or fallback_node_tag) then
|
if _node.balancingStrategy == "leastPing" or _node.balancingStrategy == "leastLoad" or fallback_node_tag then
|
||||||
local t = api.format_go_time(_node.probeInterval)
|
local t = api.format_go_time(_node.probeInterval)
|
||||||
if t == "0s" then
|
if t == "0s" then
|
||||||
t = "60s"
|
t = "60s"
|
||||||
elseif not t:find("[hm]") and tonumber(t:match("%d+")) < 10 then
|
elseif not t:find("[hm]") and tonumber(t:match("%d+")) < 10 then
|
||||||
t = "10s"
|
t = "10s"
|
||||||
end
|
end
|
||||||
observatory = {
|
if _node.balancingStrategy == "leastLoad" then
|
||||||
subjectSelector = { "blc-" },
|
burstObservatory = burstObservatory or {
|
||||||
probeUrl = _node.useCustomProbeUrl and _node.probeUrl or "https://www.google.com/generate_204",
|
subjectSelector = { "blc-" },
|
||||||
probeInterval = t,
|
pingConfig = {
|
||||||
enableConcurrency = true
|
destination = _node.useCustomProbeUrl and _node.probeUrl or nil,
|
||||||
}
|
interval = t,
|
||||||
|
sampling = 3,
|
||||||
|
timeout = "5s"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
observatory = observatory or {
|
||||||
|
subjectSelector = { "blc-" },
|
||||||
|
probeUrl = _node.useCustomProbeUrl and _node.probeUrl or nil,
|
||||||
|
probeInterval = t,
|
||||||
|
enableConcurrency = true
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
local loopback_outbound = gen_loopback(loopback_tag, loopback_dst)
|
local loopback_outbound = gen_loopback(loopback_tag, loopback_dst)
|
||||||
local inbound_tag = loopback_outbound.settings.inboundTag
|
local inbound_tag = loopback_outbound.settings.inboundTag
|
||||||
@@ -1670,7 +1683,8 @@ function gen_config(var)
|
|||||||
-- 传出连接
|
-- 传出连接
|
||||||
outbounds = outbounds,
|
outbounds = outbounds,
|
||||||
-- 连接观测
|
-- 连接观测
|
||||||
observatory = observatory,
|
observatory = (not burstObservatory) and observatory or nil,
|
||||||
|
burstObservatory = burstObservatory,
|
||||||
-- 路由
|
-- 路由
|
||||||
routing = routing,
|
routing = routing,
|
||||||
-- 本地策略
|
-- 本地策略
|
||||||
|
|||||||
Reference in new issue
Block a user