|
|
@@ -531,6 +531,18 @@ end
|
|
|
udpHop = (server.flag_port_hopping == "1") and {
|
|
|
ports = string.gsub(server.port_range, ":", "-"),
|
|
|
interval = (function(v)
|
|
|
+ if not v then return 30 end
|
|
|
+ if v:find("-", 1, true) then
|
|
|
+ local min, max = v:match("^(%d+)%-(%d+)$")
|
|
|
+ min = tonumber(min)
|
|
|
+ max = tonumber(max)
|
|
|
+ if min and max then
|
|
|
+ min = (min >= 5) and min or 5
|
|
|
+ max = (max >= min) and max or min
|
|
|
+ return min .. "-" .. max
|
|
|
+ end
|
|
|
+ return 30
|
|
|
+ end
|
|
|
v = tonumber((v or "30"):match("^%d+"))
|
|
|
return (v and v >= 5) and v or 30
|
|
|
end)(server.hopinterval)
|
|
|
@@ -740,12 +752,30 @@ local hysteria2 = {
|
|
|
listen = "0.0.0.0:" .. tonumber(socks_port),
|
|
|
disableUDP = false
|
|
|
} or nil,
|
|
|
- transport = server.transport_protocol and {
|
|
|
+ transport = {
|
|
|
type = server.transport_protocol or "udp",
|
|
|
- udp = (server.port_range and (server.hopinterval) and {
|
|
|
- hopInterval = (server.port_range and (tonumber(server.hopinterval) .. "s") or nil)
|
|
|
- } or nil)
|
|
|
- } or nil,
|
|
|
+ udp = server.port_range and (function()
|
|
|
+ local udp = {}
|
|
|
+ local t = server.hopinterval
|
|
|
+ if not t then return nil end
|
|
|
+ if t:find("-", 1, true) then
|
|
|
+ local min, max = t:match("^(%d+)%-(%d+)$")
|
|
|
+ min = tonumber(min)
|
|
|
+ max = tonumber(max)
|
|
|
+ if min and max then
|
|
|
+ min = (min >= 5) and min or 5
|
|
|
+ max = (max >= min) and max or min
|
|
|
+ udp.minHopInterval = min .. "s"
|
|
|
+ udp.maxHopInterval = max .. "s"
|
|
|
+ return udp
|
|
|
+ end
|
|
|
+ end
|
|
|
+ t = tonumber((t or "30"):match("^%d+"))
|
|
|
+ t = (t and t >= 5) and t or 30
|
|
|
+ udp.hopInterval = t .. "s"
|
|
|
+ return udp
|
|
|
+ end)() or nil
|
|
|
+ },
|
|
|
--[[
|
|
|
tcpTProxy = (proto:find("tcp") and local_port ~= "0") and {
|
|
|
listen = "0.0.0.0:" .. tonumber(local_port)
|