فهرست منبع

luci-app-ssr-plus: hysteria2 hopInterval support range

zxlhhyccc 1 روز پیش
والد
کامیت
a27c78cc59

+ 3 - 2
luci-app-ssr-plus/luasrc/model/cbi/shadowsocksr/client-config.lua

@@ -609,7 +609,7 @@ o = s:option(Value, "port_range", translate("Port hopping range"))
 o.description = translate("Format as 10000:20000 or 10000-20000 Multiple groups are separated by commas (,).")
 o:depends({type = "hysteria2", flag_port_hopping = true})
 o:depends({type = "v2ray", v2ray_protocol = "hysteria2", flag_port_hopping = true})
---o.datatype = "portrange"
+o.datatype = "or(uinteger,portrange)"
 o.rmempty = true
 
 o = s:option(Flag, "flag_transport", translate("Enable Transport Protocol Settings"))
@@ -624,9 +624,10 @@ o.default = "udp"
 o.rmempty = true
 
 o = s:option(Value, "hopinterval", translate("Port Hopping Interval(Unit:Second)"))
+o.description = translate("Supports a fixed value or a random range (e.g., 30, 5-30), minimum 5.")
 o:depends({type = "hysteria2", flag_transport = true, flag_port_hopping = true})
 o:depends({type = "v2ray", v2ray_protocol = "hysteria2", flag_port_hopping = true})
-o.datatype = "uinteger"
+o.datatype = "or(uinteger,portrange)"
 o.rmempty = true
 o.default = "30"
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 166 - 162
luci-app-ssr-plus/po/templates/ssr-plus.pot


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 166 - 162
luci-app-ssr-plus/po/zh_Hans/ssr-plus.po


+ 35 - 5
luci-app-ssr-plus/root/usr/share/shadowsocksr/gen_config.lua

@@ -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)

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است