mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-15 21:13:00 +08:00
🎉 Sync 2026-08-28 01:19:01
This commit is contained in:
1 parent
3ebef8b234
commit
a0bd643038
27 files changed
+202
-141
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