🌈 Sync 2024-04-01 00:23

This commit is contained in:
github-actions[bot] 2024-04-01 00:23:57 +08:00
parent 9b179b42d3
commit 8351d03e39
6 changed files with 62 additions and 26 deletions

View File

@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=ddns-go
KG_VERSION:=6.2.1
PKG_VERSION:=6.3.1
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/jeessy2/ddns-go.git
PKG_MIRROR_HASH:=8ec2af48833b5e17ccc21b017121dcbfecdc92e44c730773a248022e03cded79
PKG_SOURCE_VERSION:=9aee04b58764fc48687b5b3448ac45dc34de1335
PKG_MIRROR_HASH:=4c4098a841eeb2ee9f519b15d3c03b475d4f86c97a2167d3d0bdaa500fac2030
PKG_SOURCE_VERSION:=8474a5a1563643c52df176a31f4114d23efa61a6
PKG_LICENSE:=AGPL-3.0-only
PKG_LICENSE_FILES:=LICENSE

View File

@ -56,10 +56,10 @@ o.rewrite_option = o.option
o = s:option(Value, option_name("hop_interval"), translate("Hop Interval"))
o.rewrite_option = o.option
o = s:option(Value, option_name("recv_window_conn"), translate("QUIC stream receive window"))
o = s:option(Value, option_name("recv_window_conn"), translate("QUIC connection receive window"))
o.rewrite_option = o.option
o = s:option(Value, option_name("recv_window"), translate("QUIC connection receive window"))
o = s:option(Value, option_name("recv_window"), translate("QUIC stream receive window"))
o.rewrite_option = o.option
o = s:option(Value, option_name("idle_timeout"), translate("Idle Timeout"))

View File

@ -94,6 +94,15 @@ o:value("leastPing")
o:value("leastLoad")
o.default = "leastLoad"
-- Fallback Node
if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.10") then
local o = s:option(ListValue, option_name("fallback_node"), translate("Fallback Node"))
o:depends({ [option_name("protocol")] = "_balancing" })
o:value("",translate("Null"))
o.default = ""
for k, v in pairs(nodes_table) do o:value(v.id, v.remark) end
end
-- 探测地址
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" })

View File

@ -646,6 +646,7 @@ function gen_config(var)
local function gen_balancer(_node, loopbackTag)
local blc_nodes = _node.balancing_node
local fallback_node_id = _node.fallback_node
local length = #blc_nodes
local valid_nodes = {}
for i = 1, length do
@ -668,6 +669,27 @@ function gen_config(var)
end
end
end
if fallback_node_id == "" then
fallback_node_id = nil
end
if fallback_node_id then
local is_new_node = true
for _, outbound in ipairs(outbounds) do
if outbound.tag == fallback_node_id then
is_new_node = false
break
end
end
if is_new_node then
local fallback_node = uci:get_all(appname, fallback_node_id)
local outbound = gen_outbound(flag, fallback_node, fallback_node_id, { fragment = xray_settings.fragment == "1" or nil })
if outbound then
table.insert(outbounds, outbound)
else
fallback_node_id = nil
end
end
end
local balancer, rule
if #valid_nodes > 0 then
@ -675,6 +697,7 @@ function gen_config(var)
balancer = {
tag = balancerTag,
selector = valid_nodes,
fallbackTag = fallback_node_id,
strategy = { type = _node.balancingStrategy or "random" }
}
if _node.balancingStrategy == "leastPing" or _node.balancingStrategy == "leastLoad" then
@ -683,23 +706,22 @@ function gen_config(var)
subjectSelector = { "blc-" },
probeUrl = _node.useCustomProbeUrl and _node.probeUrl or nil,
probeInterval = _node.probeInterval or "1m",
enableConcurrency = node.type == "Xray" and true or nil --这里只判断顶层节点(分流总节点/单独的负载均衡节点)类型为Xray就可以启用并发
enableConcurrency = true
}
end
end
if loopbackTag and loopbackTag ~= "" then
local inboundTag = loopbackTag .. "-in"
table.insert(outbounds, {
protocol = "loopback",
tag = loopbackTag,
settings = { inboundTag = inboundTag }
})
rule = {
type = "field",
inboundTag = { inboundTag },
balancerTag = balancerTag
}
end
if loopbackTag == nil or loopbackTag =="" then loopbackTag = _node[".name"] end
local inboundTag = loopbackTag .. "-in"
table.insert(outbounds, {
protocol = "loopback",
tag = loopbackTag,
settings = { inboundTag = inboundTag }
})
rule = {
type = "field",
inboundTag = { inboundTag },
balancerTag = balancerTag
}
end
return balancer, rule
end
@ -891,9 +913,10 @@ function gen_config(var)
end
end
if is_new_balancer then
local balancer = gen_balancer(_node)
local balancer, rule = gen_balancer(_node)
if balancer then
table.insert(balancers, balancer)
table.insert(rules, rule)
rule_balancerTag = balancer.tag
end
end
@ -1020,11 +1043,12 @@ function gen_config(var)
}
elseif node.protocol == "_balancing" then
if node.balancing_node then
local balancer = gen_balancer(node)
local balancer, rule = gen_balancer(node)
routing = {
balancers = { balancer },
rules = {
{ type = "field", network = "tcp,udp", balancerTag = balancer.tag }
{ type = "field", network = "tcp,udp", balancerTag = balancer.tag },
rule
}
}
end
@ -1286,7 +1310,7 @@ function gen_config(var)
-- }
}
}
if xray_settings.fragment == "1" then
table.insert(outbounds, {
protocol = "freedom",
@ -1305,9 +1329,9 @@ function gen_config(var)
tcpNoDelay = true
}
}
})
})
end
table.insert(outbounds, {
protocol = "freedom",
tag = "direct",

View File

@ -388,6 +388,9 @@ msgstr "负载均衡"
msgid "Balancing Strategy"
msgstr "负载均衡策略"
msgid "Fallback Node"
msgstr "后备节点"
msgid "Use Custome Probe URL"
msgstr "使用自定义探测网址"

View File

@ -1943,7 +1943,7 @@ main(int argc, char **argv)
memcpy(text, protocol, strlen(protocol) - 11);
int length = strlen(protocol) - 11;
free(protocol);
obfs = (char*)malloc(length);
protocol = (char*)malloc(length);
memset(protocol, 0x00, length);
memcpy(protocol, text, length);
LOGI("protocol compatible enable, %s", protocol);