From 555e431af22ec1c0d5cd95de0d859ae89b4a3d21 Mon Sep 17 00:00:00 2001 From: action Date: Fri, 26 Jun 2026 15:45:01 +0800 Subject: [PATCH] update 2026-06-26 15:45:01 --- .../cbi/passwall/client/type/hysteria2.lua | 14 ++++++ .../model/cbi/passwall/client/type/ray.lua | 12 +++++ .../cbi/passwall/client/type/sing-box.lua | 12 +++++ .../cbi/passwall/server/type/hysteria2.lua | 14 ++++++ .../model/cbi/passwall/server/type/ray.lua | 12 +++++ .../cbi/passwall/server/type/sing-box.lua | 12 +++++ .../luasrc/passwall/util_hysteria2.lua | 23 ++++++++++ .../luasrc/passwall/util_sing-box.lua | 44 +++++++++++++++---- .../luasrc/passwall/util_xray.lua | 24 ++++++++-- .../passwall/node_config/link_share_man.htm | 20 ++++++++- luci-app-passwall/po/zh-cn/passwall.po | 10 ++++- .../usr/share/passwall/clash_subconverter.lua | 2 + .../root/usr/share/passwall/subscribe.lua | 4 ++ redsocks2/Makefile | 4 +- 14 files changed, 189 insertions(+), 18 deletions(-) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua index 53f06f01..d57f6f12 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/hysteria2.lua @@ -76,6 +76,20 @@ o.rewrite_option = o.option o:depends({ [_n("obfs_type")] = "salamander" }) o:depends({ [_n("obfs_type")] = "gecko" }) +o = s:option(Value, _n("obfs_MinPacketSize"), translate("Gecko Packet Size (min)")) +o.datatype = "uinteger" +o.placeholder = "512" +o.default = "512" +o:depends({ [_n("obfs_type")] = "gecko" }) +o.rewrite_option = o.option + +o = s:option(Value, _n("obfs_MaxPacketSize"), translate("Gecko Packet Size (max)")) +o.datatype = "uinteger" +o.placeholder = "1200" +o.default = "1200" +o:depends({ [_n("obfs_type")] = "gecko" }) +o.rewrite_option = o.option + o = s:option(Flag, _n("fast_open"), translate("Fast Open")) o.default = "0" diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua index fe9b7458..c272c50d 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/client/type/ray.lua @@ -376,6 +376,18 @@ o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password")) o:depends({ [_n("hysteria2_obfs_type")] = "salamander" }) o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) +o = s:option(Value, _n("hysteria2_obfs_MinPacketSize"), translate("Gecko Packet Size (min)")) +o.datatype = "uinteger" +o.placeholder = "512" +o.default = "512" +o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + +o = s:option(Value, _n("hysteria2_obfs_MaxPacketSize"), translate("Gecko Packet Size (max)")) +o.datatype = "uinteger" +o.placeholder = "1200" +o.default = "1200" +o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) o:depends({ [_n("protocol")] = "hysteria2" }) 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 5ebab8fc..1c7e5723 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 @@ -400,6 +400,18 @@ if singbox_tags:find("with_quic") then o:depends({ [_n("hysteria2_obfs_type")] = "salamander" }) o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + o = s:option(Value, _n("hysteria2_obfs_MinPacketSize"), translate("Gecko Packet Size (min)")) + o.datatype = "uinteger" + o.placeholder = "512" + o.default = "512" + o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + + o = s:option(Value, _n("hysteria2_obfs_MaxPacketSize"), translate("Gecko Packet Size (max)")) + o.datatype = "uinteger" + o.placeholder = "1200" + o.default = "1200" + o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + o = s:option(Value, _n("hysteria2_up_mbps"), translate("Max upload Mbps")) o:depends({ [_n("protocol")] = "hysteria2" }) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua index 6d80af23..e3402ac3 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/hysteria2.lua @@ -65,6 +65,20 @@ o.rewrite_option = o.option o:depends({ [_n("obfs_type")] = "salamander" }) o:depends({ [_n("obfs_type")] = "gecko" }) +o = s:option(Value, _n("obfs_MinPacketSize"), translate("Gecko Packet Size (min)")) +o.datatype = "uinteger" +o.placeholder = "512" +o.default = "512" +o:depends({ [_n("obfs_type")] = "gecko" }) +o.rewrite_option = o.option + +o = s:option(Value, _n("obfs_MaxPacketSize"), translate("Gecko Packet Size (max)")) +o.datatype = "uinteger" +o.placeholder = "1200" +o.default = "1200" +o:depends({ [_n("obfs_type")] = "gecko" }) +o.rewrite_option = o.option + o = s:option(Flag, _n("udp"), translate("UDP")) o.default = "1" o.rewrite_option = o.option diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua index 85499e0b..64b6f2fb 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/ray.lua @@ -155,6 +155,18 @@ o = s:option(Value, _n("hysteria2_obfs_password"), translate("Obfs Password")) o:depends({ [_n("hysteria2_obfs_type")] = "salamander" }) o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) +o = s:option(Value, _n("hysteria2_obfs_MinPacketSize"), translate("Gecko Packet Size (min)")) +o.datatype = "uinteger" +o.placeholder = "512" +o.default = "512" +o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + +o = s:option(Value, _n("hysteria2_obfs_MaxPacketSize"), translate("Gecko Packet Size (max)")) +o.datatype = "uinteger" +o.placeholder = "1200" +o.default = "1200" +o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + o = s:option(Flag, _n("hysteria2_ignore_client_bandwidth"), translate("Client BBR Flow Control")) o.default = 0 o:depends({ [_n("protocol")] = "hysteria2" }) diff --git a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua index 572478ac..92ff2fa2 100644 --- a/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua +++ b/luci-app-passwall/luasrc/model/cbi/passwall/server/type/sing-box.lua @@ -188,6 +188,18 @@ if singbox_tags:find("with_quic") then o:depends({ [_n("hysteria2_obfs_type")] = "salamander" }) o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + o = s:option(Value, _n("hysteria2_obfs_MinPacketSize"), translate("Gecko Packet Size (min)")) + o.datatype = "uinteger" + o.placeholder = "512" + o.default = "512" + o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + + o = s:option(Value, _n("hysteria2_obfs_MaxPacketSize"), translate("Gecko Packet Size (max)")) + o.datatype = "uinteger" + o.placeholder = "1200" + o.default = "1200" + o:depends({ [_n("hysteria2_obfs_type")] = "gecko" }) + o = s:option(Flag, _n("hysteria2_ignore_client_bandwidth"), translate("Client BBR Flow Control"), translate("Commands the client to use the BBR flow control algorithm")) o.default = 0 o:depends({ [_n("protocol")] = "hysteria2" }) diff --git a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua index b8497914..8c43f811 100644 --- a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua +++ b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua @@ -39,6 +39,18 @@ function gen_config_server(node) stunServers = node.hysteria2_realm_stun } or nil } + + if config.obfs and config.obfs.gecko then + local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512 + local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200 + if min <= 0 or min > max or max > 2048 then + min = 512 + max = 1200 + end + config.obfs.gecko.minPacketSize = min + config.obfs.gecko.maxPacketSize = max + end + return config end @@ -157,6 +169,17 @@ function gen_config(var) } or nil } + if config.obfs and config.obfs.gecko then + local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512 + local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200 + if min <= 0 or min > max or max > 2048 then + min = 512 + max = 1200 + end + config.obfs.gecko.minPacketSize = min + config.obfs.gecko.maxPacketSize = max + end + return jsonc.stringify(config, 1) end diff --git a/luci-app-passwall/luasrc/passwall/util_sing-box.lua b/luci-app-passwall/luasrc/passwall/util_sing-box.lua index a720b85f..4784c864 100644 --- a/luci-app-passwall/luasrc/passwall/util_sing-box.lua +++ b/luci-app-passwall/luasrc/passwall/util_sing-box.lua @@ -561,10 +561,24 @@ function gen_outbound(flag, node, tag, proxy_table) hop_interval_max = interval_max, 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 = node.hysteria2_obfs_type and { - type = node.hysteria2_obfs_type, - password = node.hysteria2_obfs_password - } or nil, + obfs = (function(t) + if not t or t == "" then return nil end + local o = { + type = t, + password = node.hysteria2_obfs_password + } + if t == "gecko" then + local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512 + local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200 + if min <= 0 or min > max or max > 2048 then + min = 512 + max = 1200 + end + o.min_packet_size = min + o.max_packet_size = max + end + return o + end)(node.hysteria2_obfs_type), password = node.hysteria2_auth_password or nil, idle_timeout = (function(t) if not version_ge_1_14_0 then return nil end @@ -917,10 +931,24 @@ function gen_config_server(node) protocol_table = { up_mbps = (node.hysteria2_ignore_client_bandwidth ~= "1" and node.hysteria2_up_mbps and tonumber(node.hysteria2_up_mbps)) and tonumber(node.hysteria2_up_mbps) or nil, down_mbps = (node.hysteria2_ignore_client_bandwidth ~= "1" and node.hysteria2_down_mbps and tonumber(node.hysteria2_down_mbps)) and tonumber(node.hysteria2_down_mbps) or nil, - obfs = node.hysteria2_obfs_type and { - type = node.hysteria2_obfs_type, - password = node.hysteria2_obfs_password - } or nil, + obfs = (function(t) + if not t or t == "" then return nil end + local o = { + type = t, + password = node.hysteria2_obfs_password + } + if t == "gecko" then + local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512 + local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200 + if min <= 0 or min > max or max > 2048 then + min = 512 + max = 1200 + end + o.min_packet_size = min + o.max_packet_size = max + end + return o + end)(node.hysteria2_obfs_type), users = { { name = "user1", diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index 6534e6b3..61d5fc9b 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -284,10 +284,18 @@ function gen_outbound(flag, node, tag, proxy_table) local o = { type = "salamander", settings = node.hysteria2_obfs_password and { - password = node.hysteria2_obfs_password, - packetSize = node.hysteria2_obfs_type == "gecko" and "512-1200" or nil + password = node.hysteria2_obfs_password } or nil } + if node.hysteria2_obfs_type == "gecko" then + local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512 + local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200 + if min <= 0 or min > max or max > 2048 then + min = 512 + max = 1200 + end + o.settings.packetSize = min .. "-" .. max + end udp[#udp+1] = o end if node.hysteria2_realms then @@ -724,10 +732,18 @@ function gen_config_server(node) local o = { type = "salamander", settings = node.hysteria2_obfs_password and { - password = node.hysteria2_obfs_password, - packetSize = node.hysteria2_obfs_type == "gecko" and "512-1200" or nil + password = node.hysteria2_obfs_password } or nil } + if node.hysteria2_obfs_type == "gecko" then + local min = tonumber(node.hysteria2_obfs_MinPacketSize) or 512 + local max = tonumber(node.hysteria2_obfs_MaxPacketSize) or 1200 + if min <= 0 or min > max or max > 2048 then + min = 512 + max = 1200 + end + o.settings.packetSize = min .. "-" .. max + end udp[#udp+1] = o end if node.hysteria2_realms then diff --git a/luci-app-passwall/luasrc/view/passwall/node_config/link_share_man.htm b/luci-app-passwall/luasrc/view/passwall/node_config/link_share_man.htm index 13a28126..9f28d93e 100644 --- a/luci-app-passwall/luasrc/view/passwall/node_config/link_share_man.htm +++ b/luci-app-passwall/luasrc/view/passwall/node_config/link_share_man.htm @@ -598,10 +598,14 @@ local current_node = map:get(section) if (v_type === "Hysteria2") { v_password = opt.get("hysteria2_auth_password"); - var dom_obfs = opt.get("hysteria2_obfs_password"); - if (dom_obfs && dom_obfs.value != "") { + var dom_obfs_type = opt.get("hysteria2_obfs_type"); + if (dom_obfs_type && dom_obfs_type.value != "") { params += opt.query("obfs", "hysteria2_obfs_type"); params += opt.query("obfs-password", "hysteria2_obfs_password"); + if (dom_obfs_type.value === "gecko") { + params += opt.query("minPacketSize", "hysteria2_obfs_MinPacketSize"); + params += opt.query("maxPacketSize", "hysteria2_obfs_MaxPacketSize"); + } } params += opt.query("mport", "hysteria2_hop"); } else { @@ -610,6 +614,10 @@ local current_node = map:get(section) if (dom_obfs_type && dom_obfs_type.value != "") { params += opt.query("obfs", dom_prefix + "hysteria2_obfs_type"); params += opt.query("obfs-password", dom_prefix + "hysteria2_obfs_password"); + if (dom_obfs_type.value === "gecko") { + params += opt.query("minPacketSize", dom_prefix + "hysteria2_obfs_MinPacketSize"); + params += opt.query("maxPacketSize", dom_prefix + "hysteria2_obfs_MaxPacketSize"); + } } params += opt.query("mport", dom_prefix + "hysteria2_hop"); if (opt.get(dom_prefix + "use_finalmask")?.checked) { @@ -1600,6 +1608,10 @@ local current_node = map:get(section) opt.set(dom_prefix + 'hysteria2_obfs_type', queryParam.obfs || "salamander"); opt.set(dom_prefix + 'hysteria2_obfs_password', queryParam["obfs-password"] || queryParam["obfs_password"]); } + if (queryParam.obfs === "gecko") { + opt.set(dom_prefix + 'hysteria2_obfs_MinPacketSize', queryParam.minPacketSize || "512"); + opt.set(dom_prefix + 'hysteria2_obfs_MaxPacketSize', queryParam.maxPacketSize || "1200"); + } opt.set(dom_prefix + 'hysteria2_hop', queryParam.mport || ""); opt.set(dom_prefix + 'use_finalmask', !!queryParam.fm); opt.set(dom_prefix + 'finalmask', queryParam.fm || ""); @@ -1611,6 +1623,10 @@ local current_node = map:get(section) opt.set(dom_prefix + 'obfs_type', queryParam.obfs || "salamander"); opt.set(dom_prefix + 'obfs_password', queryParam["obfs-password"] || queryParam["obfs_password"]); } + if (queryParam.obfs === "gecko") { + opt.set(dom_prefix + 'obfs_MinPacketSize', queryParam.minPacketSize || "512"); + opt.set(dom_prefix + 'obfs_MaxPacketSize', queryParam.maxPacketSize || "1200"); + } opt.set(dom_prefix + 'hop', queryParam.mport || ""); } diff --git a/luci-app-passwall/po/zh-cn/passwall.po b/luci-app-passwall/po/zh-cn/passwall.po index 38f7f8e6..41b002d8 100644 --- a/luci-app-passwall/po/zh-cn/passwall.po +++ b/luci-app-passwall/po/zh-cn/passwall.po @@ -698,10 +698,10 @@ msgid "Certificate fingerprint" msgstr "证书指纹" msgid "Max upload Mbps" -msgstr "最大上行(Mbps)" +msgstr "最大上行(Mbps)" msgid "Max download Mbps" -msgstr "最大下行(Mbps)" +msgstr "最大下行(Mbps)" msgid "QUIC stream receive window" msgstr "QUIC 流接收窗口" @@ -2128,3 +2128,9 @@ msgstr "正在处理,请稍候…" msgid "Invalid Realm URL." msgstr "Realm URL 不正确。" + +msgid "Gecko Packet Size (min)" +msgstr "Gecko 包大小(最小)" + +msgid "Gecko Packet Size (max)" +msgstr "Gecko 包大小(最大)" diff --git a/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua b/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua index c2aaea13..57d278e6 100644 --- a/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua +++ b/luci-app-passwall/root/usr/share/passwall/clash_subconverter.lua @@ -398,6 +398,8 @@ local function encode_hysteria2(node) if node["ports"] then table.insert(p, "mport=" .. urlencode(node["ports"])) end if node.obfs then table.insert(p, "obfs=" .. node.obfs) end if node["obfs-password"] then table.insert(p, "obfs-password=" .. node["obfs-password"]) end + if node["obfs-min-packet-size"] then table.insert(p, "minPacketSize=" .. node["obfs-min-packet-size"]) end + if node["obfs-max-packet-size"] then table.insert(p, "maxPacketSize=" .. node["obfs-max-packet-size"]) end if node.up then table.insert(p, "upmbps=" .. node.up) end if node.down then table.insert(p, "downmbps=" .. node.down) end diff --git a/luci-app-passwall/root/usr/share/passwall/subscribe.lua b/luci-app-passwall/root/usr/share/passwall/subscribe.lua index 87066bc1..39bde9da 100755 --- a/luci-app-passwall/root/usr/share/passwall/subscribe.lua +++ b/luci-app-passwall/root/usr/share/passwall/subscribe.lua @@ -1419,6 +1419,10 @@ local function processData(szType, content, add_mode, group, sub_cfg) result.hysteria2_obfs_type = params.obfs or "salamander" result.hysteria2_obfs_password = params["obfs-password"] or params["obfs_password"] end + if params.obfs == "gecko" then + result.hysteria2_obfs_MinPacketSize = params.minpacketsize or "512" + result.hysteria2_obfs_MaxPacketSize = params.maxpacketsize or "1200" + end if (sub_hysteria2_type == "sing-box" and has_singbox) or (sub_hysteria2_type == "xray" and has_xray) then local is_singbox = sub_hysteria2_type == "sing-box" and has_singbox diff --git a/redsocks2/Makefile b/redsocks2/Makefile index 9f2949f6..6f59249f 100644 --- a/redsocks2/Makefile +++ b/redsocks2/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=redsocks2 -PKG_VERSION:=0.73 +PKG_VERSION:=0.73.1 PKG_RELEASE:=1 PKG_SOURCE:=redsocks-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/kenzok8/redsocks/tar.gz/release-$(PKG_VERSION)? -PKG_HASH:=0c9a50b6039cd9fe078a3da5fb5317e38fe52ec59fba7fa9abdf3b002471ebfd +PKG_HASH:=b8049f747f5b77dacc93d322bf870f458d37423361aeb6a078c0c8dcbc75c05d PKG_BUILD_DIR:=$(BUILD_DIR)/redsocks-release-$(PKG_VERSION) PKG_MAINTAINER:=semigodking