From 623962611b65031147106077045e6ff8e709a752 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Mon, 17 Mar 2025 23:30:20 +0800 Subject: [PATCH] luci-app-passwall: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall/commit/148d9459cbcb15b346514dc3ac475eb62e9fb3ee --- .../luasrc/model/cbi/passwall/client/type/sing-box.lua | 4 ++++ luci-app-passwall/luasrc/passwall/util_sing-box.lua | 10 ++++++++++ luci-app-passwall/po/zh-cn/passwall.po | 6 ++++++ 3 files changed, 20 insertions(+) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua index eb90c5da9..189be90f1 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/sing-box.lua @@ -401,6 +401,10 @@ if singbox_tags:find("with_quic") then end if singbox_tags:find("with_quic") then + o = s:option(Value, _n("hysteria2_ports"), translate("Port hopping range")) + o.description = translate("Format as 1000:2000 Multiple groups are separated by commas (,).") + o:depends({ [_n("protocol")] = "hysteria2" }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) o:depends({ [_n("protocol")] = "hysteria2" }) diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index c4a26a761..37f1fd475 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -383,7 +383,17 @@ function gen_outbound(flag, node, tag, proxy_table) end if node.protocol == "hysteria2" then + local server_ports = {} + if node.hysteria2_ports then + for range in node.hysteria2_ports:gmatch("([^,]+)") do + if range:match("^%d+:%d+$") then + table.insert(server_ports, range) + end + end + end protocol_table = { + server_ports = next(server_ports) and server_ports or nil, + hop_interval = next(server_ports) and "30s" or nil, up_mbps = (node.hysteria2_up_mbps and tonumber(node.hysteria2_up_mbps)) and tonumber(node.hysteria2_up_mbps) or nil, down_mbps = (node.hysteria2_down_mbps and tonumber(node.hysteria2_down_mbps)) and tonumber(node.hysteria2_down_mbps) or nil, obfs = { diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 929cd133b..2925a998b 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -1821,3 +1821,9 @@ msgstr "中断现有连接" msgid "Interrupt existing connections when the selected outbound has changed." msgstr "当选择的出站发生变化时中断现有连接。" + +msgid "Port hopping range" +msgstr "端口跳跃范围" + +msgid "Format as 1000:2000 Multiple groups are separated by commas (,)." +msgstr "格式为:1000:2000 多组时用逗号(,)隔开。"