# dns/lookup Resolve a hostname to address strings through the system resolver (`getaddrinfo`). ## Syntax
[dns/lookup $host ?$opts]
## Parameters - `$host` — hostname or IP literal (string) - `$opts` — optional option map: - `:family` — `:ipv4`, `:ipv6`, or `:any` (default `:any`) - `:socktype` — `:stream` (default), `:dgram`, or `:any` - `:protocol` — `:tcp`, `:udp`, or `:any` (default `:any`) - `:flags` — vector of `:passive`, `:canonname`, `:numerichost`, `:numericserv`, `:v4mapped`, `:all`, `:addrconfig` - `:port` — service/port number (0..65535) passed to `getaddrinfo` - `:backend` — `:system`/`:libc` (default); `:c-ares` is not vendored and returns an `%Err` ## Examples
[dns/lookup "example.com"]
# => @{ "93.184.216.34" "2606:2800:220:1:248:1893:25c8:1946" }

[dns/lookup "localhost" %{ :family :ipv4 }]
# => @{ "127.0.0.1" }

# Literal fast path — no resolver traffic:
[dns/lookup "127.0.0.1" %{ :flags @{ :numerichost } }]
# => @{ "127.0.0.1" }
## Returns Vector of address strings (no port), de-duplicated in resolution order, or `%Err{:message}`. Addresses are ordered as the resolver returned them (`:any` family may mix IPv4 and IPv6). ## Notes Resolution is synchronous — the call blocks the VM thread for the duration of the lookup, same as `net/connect`'s internal resolution. There is no TTL: `getaddrinfo` does not expose one. ## See Also `dns/addr-info`, `dns/reverse`, `dns/parse`, `net/connect`