diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua index 3f1e283..7b6bd7d 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/hysteria2.lua @@ -26,7 +26,8 @@ o = s:option(Value, _n("address"), translate("Address (Support Domain Name)")) o = s:option(Value, _n("port"), translate("Port")) o.datatype = "port" -o = s:option(Value, _n("hop"), translate("Additional ports for hysteria hop")) +o = s:option(Value, _n("hop"), translate("Port hopping range")) +o.description = translate("Format as 1000:2000 or 1000-2000 Multiple groups are separated by commas (,).") o.rewrite_option = o.option o = s:option(Value, _n("obfs"), translate("Obfs Password")) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua index 4b78347..3859e57 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/type/sing-box.lua @@ -404,8 +404,8 @@ 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 = s:option(Value, _n("hysteria2_hop"), translate("Port hopping range")) + o.description = translate("Format as 1000:2000 or 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")) diff --git a/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua b/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua index 1d084a8..2065cb0 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_hysteria2.lua @@ -54,7 +54,7 @@ function gen_config(var) local server = server_host .. ":" .. server_port if (node.hysteria2_hop) then - server = server .. "," .. node.hysteria2_hop + server = server .. "," .. string.gsub(node.hysteria2_hop, ":", "-") end local config = { diff --git a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 99590a8..06ebb55 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -350,8 +350,9 @@ function gen_outbound(flag, node, tag, proxy_table) if node.protocol == "hysteria2" then local server_ports = {} - if node.hysteria2_ports then - for range in node.hysteria2_ports:gmatch("([^,]+)") do + if node.hysteria2_hop then + node.hysteria2_hop = string.gsub(node.hysteria2_hop, "-", ":") + for range in node.hysteria2_hop:gmatch("([^,]+)") do if range:match("^%d+:%d+$") then table.insert(server_ports, range) end diff --git a/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm b/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm index 9c02990..4e487a5 100644 --- a/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm +++ b/luci-app-passwall2/luasrc/view/passwall2/node_list/link_share_man.htm @@ -511,7 +511,7 @@ local hysteria2_type = map:get("@global_subscribe[0]", "hysteria2_type") or "sin params += opt.query("obfs", dom_prefix + "hysteria2_obfs_type"); params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password"); } - params += opt.query("mport", dom_prefix + "hysteria2_ports"); + params += opt.query("mport", dom_prefix + "hysteria2_hop"); } params = params.replace(/^&/, ""); url = @@ -1300,7 +1300,7 @@ local hysteria2_type = map:get("@global_subscribe[0]", "hysteria2_type") or "sin opt.set(dom_prefix + 'hysteria2_obfs_type', "salamander"); opt.set(dom_prefix + 'hysteria2_obfs_password', queryParam["obfs-password"]); } - opt.set(dom_prefix + 'hysteria2_ports', queryParam.mport || ""); + opt.set(dom_prefix + 'hysteria2_hop', queryParam.mport || ""); } else if (has_hysteria2) { opt.set('type', "Hysteria2"); dom_prefix = "hysteria2_" diff --git a/luci-app-passwall2/po/zh-cn/passwall2.po b/luci-app-passwall2/po/zh-cn/passwall2.po index 0708bb6..750ff3d 100644 --- a/luci-app-passwall2/po/zh-cn/passwall2.po +++ b/luci-app-passwall2/po/zh-cn/passwall2.po @@ -1492,9 +1492,6 @@ msgstr "空闲超时 " msgid "Hop Interval" msgstr "端口跳跃时间 " -msgid "Additional ports for hysteria hop" -msgstr "端口跳跃额外端口" - msgid "HeartbeatPeriod(second)" msgstr "心跳周期(单位:秒)" @@ -1690,5 +1687,5 @@ msgstr "当选择的出站发生变化时中断现有连接。" msgid "Port hopping range" msgstr "端口跳跃范围" -msgid "Format as 1000:2000 Multiple groups are separated by commas (,)." -msgstr "格式为:1000:2000 多组时用逗号(,)隔开。" +msgid "Format as 1000:2000 or 1000-2000 Multiple groups are separated by commas (,)." +msgstr "格式为:1000:2000 或 1000-2000 多组时用逗号(,)隔开。" diff --git a/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua b/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua index c236d12..527c633 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua +++ b/luci-app-passwall2/root/usr/share/passwall2/subscribe.lua @@ -1222,6 +1222,7 @@ local function processData(szType, content, add_mode, add_from) result.tls_allowInsecure = allowInsecure_default and "1" or "0" end result.hysteria2_tls_pinSHA256 = params.pinSHA256 + result.hysteria2_hop = params.mport if hysteria2_type_default == "sing-box" and has_singbox then result.type = 'sing-box' @@ -1230,13 +1231,11 @@ local function processData(szType, content, add_mode, add_from) result.hysteria2_obfs_type = "salamander" result.hysteria2_obfs_password = params["obfs-password"] end - result.hysteria2_ports = params.mport elseif has_hysteria2 then result.type = "Hysteria2" if params["obfs-password"] then result.hysteria2_obfs = params["obfs-password"] end - result.hysteria2_hop = params.mport end elseif szType == 'tuic' then local alias = ""