update 2024-05-23 00:22:32

This commit is contained in:
kenzok8 2024-05-23 00:22:32 +08:00
parent eae89d5de1
commit 4554610a74
3 changed files with 13 additions and 7 deletions

View File

@ -27,6 +27,7 @@ local header_type_list = {
"none", "srtp", "utp", "wechat-video", "dtls", "wireguard"
}
local xray_version = api.get_app_version("xray")
-- [[ Xray ]]
s.fields["type"]:value(type_name, "Xray")
@ -106,9 +107,11 @@ o:value("leastPing")
o.default = "leastPing"
-- Fallback Node
if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.10") then
if api.compare_versions(xray_version, ">=", "1.8.10") then
local o = s:option(ListValue, option_name("fallback_node"), translate("Fallback Node"))
o:depends({ [option_name("balancingStrategy")] = "leastPing" })
if api.compare_versions(xray_version, "<", "1.8.12") then
o:depends({ [option_name("balancingStrategy")] = "leastPing" })
end
o:value("",translate("Null"))
o.default = ""
local function check_fallback_chain(fb)
@ -130,6 +133,7 @@ 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" })
o:depends({ [option_name("fallback_node")] = "", ["!reverse"] = true })
local o = s:option(Value, option_name("probeUrl"), translate("Probe URL"))
o:depends({ [option_name("useCustomProbeUrl")] = true })
@ -139,6 +143,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("fallback_node")] = "", ["!reverse"] = true })
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 <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.")
@ -401,7 +406,7 @@ o = s:option(Value, option_name("wireguard_mtu"), translate("MTU"))
o.default = "1420"
o:depends({ [option_name("protocol")] = "wireguard" })
if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.0") then
if api.compare_versions(xray_version, ">=", "1.8.0") then
o = s:option(Value, option_name("wireguard_reserved"), translate("Reserved"), translate("Decimal numbers separated by \",\" or Base64-encoded strings."))
o:depends({ [option_name("protocol")] = "wireguard" })
end

View File

@ -693,7 +693,8 @@ function gen_config(var)
-- fallback node
local fallback_node_id = _node.fallback_node
if fallback_node_id and fallback_node_id ~= "" then
if fallback_node_id == "" then fallback_node_id = nil
if fallback_node_id then
local is_new_node = true
for _, outbound in ipairs(outbounds) do
if outbound.tag == fallback_node_id then
@ -723,7 +724,7 @@ function gen_config(var)
fallbackTag = fallback_node_id,
strategy = { type = _node.balancingStrategy or "random" }
})
if _node.balancingStrategy == "leastPing" then
if _node.balancingStrategy == "leastPing" or fallback_node_id then
if not observatory then
observatory = {
subjectSelector = { "blc-" },

View File

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=xray-plugin
PKG_VERSION:=1.8.11
PKG_VERSION:=1.8.12
PKG_RELEASE:=1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/teddysun/xray-plugin/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=71fac8c5f816f493b120549d64ccc14cf6534c0a7db619a4cee292adb306e9dd
PKG_HASH:=dddc552e1d3616a93bd93082439f042c048833307eb009a4df97f336deac3346
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE