update 2026-05-18 23:19:08

This commit is contained in:
action committed 2026-05-18 23:19:09 +08:00
1 parent e6696f2057
commit 53eda83da8
35 files changed
+620 -281

No files matched your search

+42 -7
View File
@@ -377,11 +377,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
@@ -497,9 +499,10 @@ function get_valid_nodes()
end
end
local port = e.port or e.hysteria_hop or e.hysteria2_hop
if port and e.address then
local is_realm = (e.type == "Hysteria2" or e.protocol == 'hysteria2') and e.hysteria2_realms or nil
if (port and e.address) or is_realm then
local address = e.address
if is_ip(address) or datatypes.hostname(address) then
if is_ip(address) or datatypes.hostname(address) or is_realm then
if (e.type == "sing-box" or e.type == "Xray") and e.protocol then
local protocol = e.protocol
if protocol == "vmess" then
@@ -526,10 +529,13 @@ function get_valid_nodes()
type_name = type_name .. " " .. protocol
end
if is_ipv6(address) then address = get_ipv6_full(address) end
type_name = is_realm and type_name .. " Realm" or type_name
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 is_realm 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
@@ -619,7 +625,10 @@ function get_node_remarks(n)
end
type_name = type_name .. " " .. protocol
end
remarks = trim("%s:[%s]" % {type_name, n.remarks})
if (n.type == "Hysteria2" or n.protocol == 'hysteria2') and n.hysteria2_realms then
type_name = type_name .. " Realm"
end
remarks = trim("%s:[%s]" % {type_name, n.remarks})
end
end
return remarks
@@ -1204,7 +1213,7 @@ function to_move(app_name,file)
}
end
local flag = sys.call('pgrep -af "passwall2/.*'.. app_name ..'" >/dev/null')
local flag = sys.call('busybox pgrep -af "passwall2/.*'.. app_name ..'" >/dev/null')
if flag == 0 then
sys.call("/etc/init.d/passwall2 stop")
end
@@ -1587,4 +1596,30 @@ function get_dnsmasq_server_domain()
end
end
return dnsmasq_server_t
end
end
function parse_realm_uri(uri)
if type(uri) ~= "string" then return nil end
-- realm://token@server/realm_id?query
local token, server_url, realm_id, query = trim(uri):match("^realm://([^@]+)@([^/]+)/([^?]*)%??(.*)$")
if not token or not server_url or not realm_id then return nil end
realm_id = realm_id:gsub("/+$", "")
local realm = {
token = token,
server_url = server_url,
realm_id = realm_id
}
-- 解析 query 中的 stun=
if query and query ~= "" then
local stun_servers = {}
for key, value in query:gmatch("([^&=?]+)=([^&]+)") do
if key == "stun" and value ~= "" then
stun_servers[#stun_servers + 1] = value
end
end
if #stun_servers > 0 then
realm.stun_servers = stun_servers
end
end
return realm
end