mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 15:45:13 +08:00
update 2026-08-28 02:44:45
This commit is contained in:
1 parent
9a3f194de9
commit
587815b344
25 files changed
+143
-250
No files matched your search
@@ -2048,4 +2048,28 @@ function gen_wireguard_key()
|
||||
public_key = public_key
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function parseDNS(dns)
|
||||
if not dns then return nil end
|
||||
if true then
|
||||
-- IPv6
|
||||
-- [::1]:5053
|
||||
local address, port = dns:match("%[(.-)%]:([0-9]+)$")
|
||||
if address and datatypes.ip6addr(address) and datatypes.port(port) then
|
||||
return address, port
|
||||
end
|
||||
-- [::1]
|
||||
if is_ipv6(dns) then
|
||||
return get_ipv6_only(dns), 53
|
||||
end
|
||||
end
|
||||
if true then
|
||||
-- 1.1.1.1:5053
|
||||
local h, p = dns:match("^([^:]+):([^:]+)$")
|
||||
if (h and p and datatypes.ip4addr(h) and datatypes.port(p)) then
|
||||
return h, p
|
||||
end
|
||||
end
|
||||
return dns, 53
|
||||
end
|
||||
Reference in new issue
Block a user