From ec98cc7413653a7122d3c9ed47c4c0b7dd4d7da8 Mon Sep 17 00:00:00 2001 From: action Date: Sun, 17 May 2026 00:54:00 +0800 Subject: [PATCH] update 2026-05-17 00:54:00 --- luci-app-passwall/luasrc/passwall/api.lua | 12 ++++++++---- luci-app-passwall/luasrc/passwall/util_hysteria2.lua | 9 +++++---- luci-app-passwall/root/usr/share/passwall/app.sh | 4 ++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/luci-app-passwall/luasrc/passwall/api.lua b/luci-app-passwall/luasrc/passwall/api.lua index 907c49a3..c4d84bd1 100644 --- a/luci-app-passwall/luasrc/passwall/api.lua +++ b/luci-app-passwall/luasrc/passwall/api.lua @@ -358,11 +358,13 @@ function is_special_node(e) end function is_ip(val) + val = trim(val):lower() local str = val:match("%[(.-)%]") or val return datatypes.ipaddr(str) or false end function is_ipv6(val) + val = trim(val):lower() local str = val:match("%[(.-)%]") or val return datatypes.ip6addr(str) or false end @@ -470,9 +472,9 @@ function get_valid_nodes() end end local port = e.port or e.hysteria_hop or e.hysteria2_hop - if port and e.address then + if (port and e.address) or e.hysteria2_realms then local address = e.address - if is_ip(address) or datatypes.hostname(address) then + if is_ip(address) or datatypes.hostname(address) or e.hysteria2_realms then if (e.type == "sing-box" or e.type == "Xray") and e.protocol then local protocol = e.protocol if protocol == "vmess" then @@ -501,8 +503,10 @@ function get_valid_nodes() if is_ipv6(address) then address = get_ipv6_full(address) end e["remark"] = trim("%s:[%s]" % {type_name, e.remarks}) if show_node_info == "1" then - port = port:gsub(":", "-") - e["remark"] = trim("%s:[%s] %s:%s" % {type_name, e.remarks, address, port}) + port = (port or ""):gsub(":", "-") + if not e.hysteria2_realms then + e["remark"] = trim("%s:[%s] %s:%s" % {type_name, e.remarks, address, port}) + end end e.node_type = "normal" if not e.group or e.group == "" then diff --git a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua index e2ca3a55..d6be50df 100644 --- a/luci-app-passwall/luasrc/passwall/util_hysteria2.lua +++ b/luci-app-passwall/luasrc/passwall/util_hysteria2.lua @@ -61,15 +61,16 @@ function gen_config(var) local local_http_password = var["local_http_password"] local tcp_proxy_way = var["tcp_proxy_way"] local server_host = var["server_host"] or (node.address or ""):lower() - local server_port = var["server_port"] or (node.port or "443") + local server_port = var["server_port"] or node.port if api.is_ipv6(server_host) then server_host = api.get_ipv6_full(server_host) end - local server = server_host .. ":" .. server_port - if (node.hysteria2_hop) then - server = server .. "," .. string.gsub(node.hysteria2_hop, ":", "-") + local server = server_host .. (server_port and ":" .. server_port or "") + + if node.hysteria2_hop then + server = server .. (server_port and "," or ":") .. string.gsub(node.hysteria2_hop, ":", "-") end local config = { diff --git a/luci-app-passwall/root/usr/share/passwall/app.sh b/luci-app-passwall/root/usr/share/passwall/app.sh index 352516c1..a542e11b 100755 --- a/luci-app-passwall/root/usr/share/passwall/app.sh +++ b/luci-app-passwall/root/usr/share/passwall/app.sh @@ -374,6 +374,10 @@ run_socks() { fi fi + if [ -n "${error_msg}" ] && [ "$(config_n_get $node hysteria2_realms)" = "1" ]; then + unset error_msg + fi + [ -n "${error_msg}" ] && { [ "$bind" != "127.0.0.1" ] && echolog " - Socks节点:[$remarks]${tmp},启动中止 ${bind}:${socks_port} ${error_msg}" return 1