luci: wireguard add reserved option when xray>=1.8.0 (#2462)
* luci: wireguard add reserved option when xray>=1.8.0 * luci: 4.63
This commit is contained in:
parent
d67f9fd5c6
commit
ac259f2d11
@ -6,8 +6,8 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=4.62
|
||||
PKG_RELEASE:=7
|
||||
PKG_VERSION:=4.63
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
||||
|
@ -748,6 +748,11 @@ wireguard_mtu = s:option(Value, "wireguard_mtu", translate("MTU"))
|
||||
wireguard_mtu.default = "1420"
|
||||
wireguard_mtu:depends({ type = "Xray", protocol = "wireguard" })
|
||||
|
||||
if api.compare_versions(api.get_app_version("xray"), ">=", "1.8.0") then
|
||||
wireguard_reserved = s:option(Value, "wireguard_reserved", translate("Reserved"))
|
||||
wireguard_reserved:depends({ type = "Xray", protocol = "wireguard" })
|
||||
end
|
||||
|
||||
wireguard_keepAlive = s:option(Value, "wireguard_keepAlive", translate("Keep Alive"))
|
||||
wireguard_keepAlive.default = "0"
|
||||
wireguard_keepAlive:depends({ type = "Xray", protocol = "wireguard" })
|
||||
|
@ -536,7 +536,7 @@ local function exec(cmd, args, writer, timeout)
|
||||
end
|
||||
end
|
||||
|
||||
local function compare_versions(ver1, comp, ver2)
|
||||
function compare_versions(ver1, comp, ver2)
|
||||
local table = table
|
||||
|
||||
if not ver1 then ver1 = "" end
|
||||
|
@ -100,6 +100,14 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
end
|
||||
end
|
||||
|
||||
if node.protocol == "wireguard" and node.wireguard_reserved then
|
||||
local bytes = {}
|
||||
node.wireguard_reserved:gsub("[^,]+", function(b)
|
||||
bytes[#bytes+1] = tonumber(b)
|
||||
end)
|
||||
node.wireguard_reserved = #bytes > 0 and bytes or nil
|
||||
end
|
||||
|
||||
result = {
|
||||
_flag_tag = node_id,
|
||||
_flag_proxy = proxy,
|
||||
@ -223,7 +231,8 @@ function gen_outbound(flag, node, tag, proxy_table)
|
||||
keepAlive = node.wireguard_keepAlive and tonumber(node.wireguard_keepAlive) or nil
|
||||
}
|
||||
} or nil,
|
||||
mtu = (node.protocol == "wireguard" and node.wireguard_mtu) and tonumber(node.wireguard_mtu) or nil
|
||||
mtu = (node.protocol == "wireguard" and node.wireguard_mtu) and tonumber(node.wireguard_mtu) or nil,
|
||||
reserved = (node.protocol == "wireguard" and node.wireguard_reserved) and node.wireguard_reserved or nil
|
||||
}
|
||||
}
|
||||
local alpn = {}
|
||||
|
Loading…
Reference in New Issue
Block a user