From 622ae52e2345e623606aacc742a714b1dac7ec31 Mon Sep 17 00:00:00 2001 From: action Date: Fri, 29 May 2026 22:52:03 +0800 Subject: [PATCH] update 2026-05-29 22:52:03 --- .../model/cbi/passwall/client/type/ray.lua | 41 +++++++++--- .../model/cbi/passwall/server/type/ray.lua | 18 ++++- .../luasrc/passwall/util_xray.lua | 66 +++++++++++++++---- naiveproxy/Makefile | 46 ++++++------- 4 files changed, 125 insertions(+), 46 deletions(-) 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 4730c274..931f5955 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 @@ -341,13 +341,28 @@ o:depends({ [_n("protocol")] = "vless" }) ---- [[hysteria2]] 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:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_realms")] = false }) o = s:option(Value, _n("hysteria2_hop_interval"), translate("Hop Interval(second)"), translate("Supports a fixed value or a random range (e.g., 30, 5-30), minimum 5.")) o.datatype = "or(uinteger,portrange)" o.placeholder = "30" o.default = "30" -o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_realms")] = false }) + +o = s:option(Flag, _n("hysteria2_realms"), translate("Realms")) +o.default = "0" +if api.compare_versions(xray_version, ">", "26.5.9") then + o:depends({ [_n("protocol")] = "hysteria2"}) +else + o:depends({ [_n("protocol")] = "__hide"}) +end + +o = s:option(Value, _n("hysteria2_realm_url"), translate("Realm URL"), translate("Example:") .. "realm://public@realm.hy2.io/your-realm-name") +o:depends({ [_n("hysteria2_realms")] = "1" }) + +o = s:option(DynamicList, _n("hysteria2_realm_stun"), translate("Realm STUN")) +o.default = { "stun.sip.us:3478", "stun.nextcloud.com:3478", "global.stun.twilio.com:3478" } +o:depends({ [_n("hysteria2_realms")] = "1" }) o = s:option(Value, _n("hysteria2_auth_password"), translate("Auth Password")) o.password = true @@ -356,10 +371,12 @@ o:depends({ [_n("protocol")] = "hysteria2"}) o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type")) o:value("", translate("Disable")) o:value("salamander") +o:value("gecko") o:depends({ [_n("protocol")] = "hysteria2" }) 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_up_mbps"), translate("Max upload Mbps")) o:depends({ [_n("protocol")] = "hysteria2" }) @@ -438,7 +455,7 @@ end o = s:option(Flag, _n("ech"), translate("ECH")) o.default = "0" o:depends({ [_n("tls")] = true, [_n("reality")] = false }) -o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_realms")] = false }) o = s:option(TextValue, _n("ech_config"), translate("ECH Config")) o.default = "" @@ -715,7 +732,7 @@ o:depends({ [_n("protocol")] = "vless" }) o:depends({ [_n("protocol")] = "trojan" }) o:depends({ [_n("protocol")] = "shadowsocks" }) o:depends({ [_n("protocol")] = "wireguard" }) -o:depends({ [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("protocol")] = "hysteria2", [_n("hysteria2_realms")] = false }) o = s:option(TextValue, _n("finalmask"), " ") o:depends({ [_n("use_finalmask")] = true }) @@ -788,10 +805,14 @@ local protocols = s.fields[_n("protocol")].keylist if #protocols > 0 then for i, v in ipairs(protocols) do if not v:find("^_") then - s.fields[_n("address")]:depends({ [_n("protocol")] = v }) - s.fields[_n("port")]:depends({ [_n("protocol")] = v }) - s.fields[_n("domain_resolver")]:depends({ [_n("protocol")] = v }) - s.fields[_n("domain_strategy")]:depends({ [_n("protocol")] = v }) + local depends_condition = { [_n("protocol")] = v } + if v == "hysteria2" then + depends_condition[_n("hysteria2_realms")] = false + end + s.fields[_n("address")]:depends(depends_condition) + s.fields[_n("port")]:depends(depends_condition) + s.fields[_n("domain_resolver")]:depends(depends_condition) + s.fields[_n("domain_strategy")]:depends(depends_condition) if v ~= "hysteria2" then s.fields[_n("tcp_fast_open")]:depends({ [_n("protocol")] = v }) @@ -814,7 +835,7 @@ if not load_shunt_options then o:value("2", translate("Landing Node")) o1 = s:option(ListValue, _n("preproxy_node"), translate("Preproxy Node"), translate("Only support a layer of proxy.")) - o1:depends({ [_n("chain_proxy")] = "1" }) + o1:depends({ [_n("chain_proxy")] = "1", [_n("hysteria2_realms")] = false }) o1.template = appname .. "/cbi/nodes_listvalue" o1.group = {} @@ -826,7 +847,7 @@ if not load_shunt_options then end o2 = s:option(ListValue, _n("to_node"), translate("Landing Node"), translate("Only support a layer of proxy.")) - o2:depends({ [_n("chain_proxy")] = "2" }) + o2:depends({ [_n("chain_proxy")] = "2", [_n("hysteria2_realms")] = false }) o2.template = appname .. "/cbi/nodes_listvalue" o2.group = {} 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 437f11c7..e12e3c7e 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 @@ -127,6 +127,17 @@ o:value("xtls-rprx-vision") o:depends({ [_n("protocol")] = "vless" }) ---- [[ hysteria2 ]] +o = s:option(Flag, _n("hysteria2_realms"), translate("Realms")) +o.default = "0" +o:depends({ [_n("protocol")] = "hysteria2"}) + +o = s:option(Value, _n("hysteria2_realm_url"), translate("Realm URL"), translate("Example:") .. "realm://public@realm.hy2.io/your-realm-name") +o:depends({ [_n("hysteria2_realms")] = "1" }) + +o = s:option(DynamicList, _n("hysteria2_realm_stun"), translate("Realm STUN")) +o.default = { "stun.sip.us:3478", "stun.nextcloud.com:3478", "global.stun.twilio.com:3478" } +o:depends({ [_n("hysteria2_realms")] = "1" }) + o = s:option(Value, _n("hysteria2_auth_password"), translate("Auth Password")) o.password = true o:depends({ [_n("protocol")] = "hysteria2"}) @@ -134,10 +145,12 @@ o:depends({ [_n("protocol")] = "hysteria2"}) o = s:option(ListValue, _n("hysteria2_obfs_type"), translate("Obfs Type")) o:value("", translate("Disable")) o:value("salamander") +o:value("gecko") o:depends({ [_n("protocol")] = "hysteria2" }) 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(Flag, _n("hysteria2_ignore_client_bandwidth"), translate("Client BBR Flow Control")) o.default = 0 @@ -210,7 +223,8 @@ function o.write(self, section, value) end o = s:option(ListValue, _n("alpn"), translate("alpn")) -o.default = "h2,http/1.1" +o.default = "default" +o:value("default", translate("Default")) o:value("h3") o:value("h2") o:value("h3,h2") @@ -375,7 +389,7 @@ o:depends({ [_n("custom")] = false, [_n("protocol")] = "vless" }) o:depends({ [_n("custom")] = false, [_n("protocol")] = "trojan" }) o:depends({ [_n("custom")] = false, [_n("protocol")] = "shadowsocks" }) o:depends({ [_n("custom")] = false, [_n("protocol")] = "wireguard" }) -o:depends({ [_n("custom")] = false, [_n("protocol")] = "hysteria2" }) +o:depends({ [_n("custom")] = false, [_n("protocol")] = "hysteria2", [_n("hysteria2_realms")] = false }) o = s:option(TextValue, _n("finalmask"), "FinalMask JSON") o:depends({ [_n("use_finalmask")] = true }) diff --git a/luci-app-passwall/luasrc/passwall/util_xray.lua b/luci-app-passwall/luasrc/passwall/util_xray.lua index edbe252c..91ee732f 100644 --- a/luci-app-passwall/luasrc/passwall/util_xray.lua +++ b/luci-app-passwall/luasrc/passwall/util_xray.lua @@ -44,8 +44,8 @@ function gen_outbound(flag, node, tag, proxy_table) local run_socks_instance = true if proxy_table ~= nil and type(proxy_table) == "table" then proxy_tag = proxy_table.tag or nil - fragment = proxy_table.fragment or nil - noise = proxy_table.noise or nil + fragment = (proxy_table.fragment and not node.hysteria2_realms) and true or nil + noise = (proxy_table.noise and not node.hysteria2_realms) and true or nil run_socks_instance = proxy_table.run_socks_instance end @@ -274,14 +274,36 @@ function gen_outbound(flag, node, tag, proxy_table) udp[#udp+1] = c finalmask.udp = udp elseif TP == "hysteria" then + local udp = {} if node.hysteria2_obfs_type and node.hysteria2_obfs_type ~= "" then - finalmask.udp = {{ - type = node.hysteria2_obfs_type, + local o = { + type = "salamander", settings = node.hysteria2_obfs_password and { - password = node.hysteria2_obfs_password + password = node.hysteria2_obfs_password, + packetSize = node.hysteria2_obfs_type == "gecko" and "512-1200" or nil } or nil - }} + } + udp[#udp+1] = o end + if node.hysteria2_realms then + local realm = api.parse_realm_uri(node.hysteria2_realm_url) + local url, stun + if realm then + if realm.token and realm.server_url and realm.realm_id then + url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id + end + stun = realm.stun_servers or node.hysteria2_realm_stun + end + local r = { + type = "realm", + settings = { + url = url, + stunServers = stun + } + } + udp[#udp+1] = r + end + finalmask.udp = udp local up = tonumber(node.hysteria2_up_mbps) or 0 local down = tonumber(node.hysteria2_down_mbps) or 0 finalmask.quicParams = { @@ -704,14 +726,36 @@ function gen_config_server(node) udp[#udp+1] = c finalmask.udp = udp elseif node.transport == "hysteria" then + local udp = {} if node.hysteria2_obfs_type and node.hysteria2_obfs_type ~= "" then - finalmask.udp = {{ - type = node.hysteria2_obfs_type, + local o = { + type = "salamander", settings = node.hysteria2_obfs_password and { - password = node.hysteria2_obfs_password + password = node.hysteria2_obfs_password, + packetSize = node.hysteria2_obfs_type == "gecko" and "512-1200" or nil } or nil - }} + } + udp[#udp+1] = o end + if node.hysteria2_realms then + local realm = api.parse_realm_uri(node.hysteria2_realm_url) + local url, stun + if realm then + if realm.token and realm.server_url and realm.realm_id then + url = "realm://" .. realm.token .. "@" .. realm.server_url .. "/" .. realm.realm_id + end + stun = realm.stun_servers or node.hysteria2_realm_stun + end + local r = { + type = "realm", + settings = { + url = url, + stunServers = stun + } + } + udp[#udp+1] = r + end + finalmask.udp = udp local ignore = tonumber(node.hysteria2_ignore_client_bandwidth) == 1 local up = (not ignore) and tonumber(node.hysteria2_up_mbps) or 0 local down = (not ignore) and tonumber(node.hysteria2_down_mbps) or 0 @@ -742,7 +786,7 @@ function gen_config_server(node) } local alpn = {} - if node.alpn then + if node.alpn and node.alpn ~= "default" then string.gsub(node.alpn, '[^' .. "," .. ']+', function(w) table.insert(alpn, w) end) diff --git a/naiveproxy/Makefile b/naiveproxy/Makefile index 34da820d..9cd1c7a3 100644 --- a/naiveproxy/Makefile +++ b/naiveproxy/Makefile @@ -9,7 +9,7 @@ PKG_REAL_VERSION:=148.0.7778.96-5 PKG_VERSION:=$(subst -,.,$(PKG_REAL_VERSION)) PKG_RELEASE:=1 -# intel 80386 & riscv64 & cortex-a76 +ARCH_PREBUILT:=$(ARCH_PACKAGES) ifeq ($(ARCH_PREBUILT),aarch64_cortex-a76) ARCH_PREBUILT:=aarch64_generic else ifeq ($(ARCH_PREBUILT),i386_pentium-mmx) @@ -20,53 +20,53 @@ else ifeq ($(ARCH_PREBUILT),riscv64_riscv64) ARCH_PREBUILT:=riscv64 endif -ifeq ($(ARCH_PACKAGES),aarch64_cortex-a53) +ifeq ($(ARCH_PREBUILT),aarch64_cortex-a53) PKG_HASH:=2cc643c0818a5b84a873ceb20132050b98dd9e6d7184bb4df47c054cc14e8b56 -else ifeq ($(ARCH_PACKAGES),aarch64_cortex-a72) +else ifeq ($(ARCH_PREBUILT),aarch64_cortex-a72) PKG_HASH:=f402da04a623aa67cde64ab86948bf5f91e0968ce12c007c575ebff94b9780e6 -else ifeq ($(ARCH_PACKAGES),aarch64_generic) +else ifeq ($(ARCH_PREBUILT),aarch64_generic) PKG_HASH:=088249b5bd8018396eda31ce4712e2304a6576528f996e597ed908bb44e5a69d -else ifeq ($(ARCH_PACKAGES),arm_arm1176jzf-s_vfp) +else ifeq ($(ARCH_PREBUILT),arm_arm1176jzf-s_vfp) PKG_HASH:=c38b1b218420a817d340f99a7c719415cdff2c6f6dc1ab0d28b7245c20db7336 -else ifeq ($(ARCH_PACKAGES),arm_arm926ej-s) +else ifeq ($(ARCH_PREBUILT),arm_arm926ej-s) PKG_HASH:=1bfb00c5c2aaa34e2802e172a13d06fd8edfa5dc3c3a9a92f898d02b43e01509 -else ifeq ($(ARCH_PACKAGES),arm_cortex-a15_neon-vfpv4) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a15_neon-vfpv4) PKG_HASH:=0aecbb0745f22535f649d28f6b1a7f0f15695af53efda3cf4d33a636858bb64b -else ifeq ($(ARCH_PACKAGES),arm_cortex-a5_vfpv4) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a5_vfpv4) PKG_HASH:=fae5b1218eaeeb39b59b16a933092e91b01225bbea472e88ff02773d332d79fc -else ifeq ($(ARCH_PACKAGES),arm_cortex-a7) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a7) PKG_HASH:=6ac9e3222de2cc079e3c6cd465d8922031e4970ff05c50d3726e8e08a2c80d75 -else ifeq ($(ARCH_PACKAGES),arm_cortex-a7_neon-vfpv4) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a7_neon-vfpv4) PKG_HASH:=ed7b3f9e4cf38eaa9e3451c36203c472a9adfefb134da5acd2b47caf7e8b4885 -else ifeq ($(ARCH_PACKAGES),arm_cortex-a7_vfpv4) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a7_vfpv4) PKG_HASH:=10242073e2aa04b8f09deb7907183ec9933a8f5cc052206c8580a56ab5b68a0d -else ifeq ($(ARCH_PACKAGES),arm_cortex-a8_vfpv3) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a8_vfpv3) PKG_HASH:=c090e56714dc71c49248c7ec54a95a295daf4f56b66ad889c51ff0eae2ceaadd -else ifeq ($(ARCH_PACKAGES),arm_cortex-a9) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a9) PKG_HASH:=2aafcb1169336924ce22eef37fef72a2e3b0504c83effc5c18a030e2e79245f8 -else ifeq ($(ARCH_PACKAGES),arm_cortex-a9_neon) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a9_neon) PKG_HASH:=4f119877f9b9326b8648b3015f129ed27f0eab3c1bf14ad59f4bd34b41c1a7ab -else ifeq ($(ARCH_PACKAGES),arm_cortex-a9_vfpv3-d16) +else ifeq ($(ARCH_PREBUILT),arm_cortex-a9_vfpv3-d16) PKG_HASH:=d47b762719889870d0ecb1b700fd444b840757c34845bd9008031bcbe564dada -else ifeq ($(ARCH_PACKAGES),arm_mpcore) +else ifeq ($(ARCH_PREBUILT),arm_mpcore) PKG_HASH:=04d609af80585520ecb96a512f203c375f2483b41256c5c220c6d687297619d1 -else ifeq ($(ARCH_PACKAGES),arm_xscale) +else ifeq ($(ARCH_PREBUILT),arm_xscale) PKG_HASH:=b98fcc755b4e542965707cae3fd87fb01e5fded09c3279f54825d917f9f0c9e2 -else ifeq ($(ARCH_PACKAGES),mipsel_24kc) +else ifeq ($(ARCH_PREBUILT),mipsel_24kc) PKG_HASH:=c7c3f3482818fea9d72598d17a03b065b9bd8bccfbe7c8226860a8ab68b12e22 -else ifeq ($(ARCH_PACKAGES),mipsel_mips32) +else ifeq ($(ARCH_PREBUILT),mipsel_mips32) PKG_HASH:=733ef1bfb67b12111ff05df38c4ee0b14228589f48be5f1f967efe04cffd7ce2 -else ifeq ($(ARCH_PACKAGES),riscv64) +else ifeq ($(ARCH_PREBUILT),riscv64) PKG_HASH:=3b9cea024b0d8c79927c463741845f1623be9544dd3b7767fc9d55b0d7c564f4 -else ifeq ($(ARCH_PACKAGES),x86) +else ifeq ($(ARCH_PREBUILT),x86) PKG_HASH:=06e4c5595b2de9f3f0f6a347add46f72e213a6686be1abc3bc8efca876c4a07d -else ifeq ($(ARCH_PACKAGES),x86_64) +else ifeq ($(ARCH_PREBUILT),x86_64) PKG_HASH:=5fce9437c84c2cec6322753c424c5f2f5621cc91d6aa3743650e6d7b54407a44 else PKG_HASH:=dummy endif -PKG_SOURCE:=naiveproxy-v$(PKG_REAL_VERSION)-openwrt-$(ARCH_PACKAGES).tar.xz +PKG_SOURCE:=naiveproxy-v$(PKG_REAL_VERSION)-openwrt-$(ARCH_PREBUILT).tar.xz PKG_SOURCE_URL:=https://github.com/klzgrad/naiveproxy/releases/download/v$(PKG_REAL_VERSION)/ PKG_BUILD_DIR:=$(BUILD_DIR)/naiveproxy-v$(PKG_REAL_VERSION)-openwrt-$(ARCH_PACKAGES)