OxL Reference

method dns.lookup

All IPv4 / IPv6 addresses of host (a name or a numeric address), in resolver order. The lookup runs on the blocking pool; timeout and cancellation stop waiting for it.

Example:

oxl✓ checked in CI
use std.net { dns, IpAddr }

fn main() io, net {
  match dns.lookup("no-such-host.invalid", 2s) {
    List<IpAddr> _ => print("resolved")
    NetError _ => print("not found")
  }
}
Output
not found
pub(api) static fn lookup(host: str, timeout: Duration? = none) -> List<IpAddr> | NetError  net

Since. 1.0.0-beta

Parameters

NameType
hoststr
timeoutDuration? = none

Returns

List<IpAddr>

Errors

  • NetError
  • `Unavailable` (name not found), `Timeout`, `Cancelled`.

Effects

net

Defined in: std/net/net.oxl:762

See also