← index

DNS

inherits Object

Name resolution — the system resolver (getaddrinfo, the same one TcpSocket.connect: uses), exposed. Lookups run on the blocking pool and park the task, not the scheduler.

DNS.resolve:'localhost'      "* a List of IP strings, e.g. #( 127.0.0.1 ::1 )
DNS.reverse:'127.0.0.1'      "* a hostname, or nil when unmapped

Forward lookups answer A + AAAA addresses in resolver order (deduplicated); a name that doesn't resolve throws a catchable IoError. Record-type queries (TXT/MX/SRV) are not the system resolver's job and are deliberately absent.

Class methods

resolve4:String

resolve:, IPv4 addresses only (possibly empty).

native

resolve6:String

resolve:, IPv6 addresses only (possibly empty).

native

resolve:String

Every address for host — IPv4 and IPv6, as Strings, in resolver order (deduplicated). A name that doesn't resolve throws a catchable IoError.

native

reverse:String

The hostname the IP reverse-resolves to (a PTR lookup via getnameinfo), or nil when the address has no mapping — that is an answer, not an error. A string that isn't an IP address throws a ValueError-kinded IoError.

native