resolve
def resolve(host: String) -> List[IpAddr] Resolve a hostname to a list of IP addresses.
Calls getaddrinfo(3) which respects /etc/hosts,
/etc/resolv.conf, and nsswitch.conf. Returns both IPv4 and
IPv6 results in OS-preference order.
Example:
var addrs = resolve("localhost")
for a in addrs:
print(a[])
- Args
host: Hostname or numeric IP string to resolve (e.g."example.com","localhost","127.0.0.1").
Raises AddressParseError: If host is empty, longer than 253 bytes
(one trailing root dot, as in "example.com.", is not
counted), has a label over 63 bytes, or contains a NUL, CR, LF
or @. The too-long message quotes the first 20 bytes of the
host, cut at a character boundary so the text stays valid UTF-8.
DnsError: On NXDOMAIN, timeout, or system resolver failure.