Module sys/dns

sys/dns
Stability: unstable — a raw wrapper over `getaddrinfo`/`getnameinfo` whose results are a linked list walked through accessor functions and whose errors are raw `gai_error` codes, not `IoError`. `std/net/dns`'s `lookup_host` is the typed face and is what callers want. It is also where a real open question lives rather than just a rough edge: a plaintext connect uses the FIRST address this returns and does not fall back to the next on failure, so a host whose IPv6 route is dead fails instead of reaching its IPv4 address. There is no happy-eyeballs, and the resolver's order decides. Fixing that will change what the typed layer asks of this one. — stable modules only change additively; this one may still change.

DNS resolution operations.

Provides async DNS resolution wrapping getaddrinfo/getnameinfo, plus accessors for iterating the linked list of addrinfo results.

All async operations return IoFuture which resolves to:

  • 0: success
  • Non-zero: raw gai_error code (EAI_NONAME, EAI_AGAIN, etc.)

Stability

unstable — a raw wrapper over getaddrinfo/getnameinfo whose results are a linked list walked through accessor functions and whose errors are raw gai_error codes, not IoError. std/net/dns's lookup_host is the typed face and is what callers want.

It is also where a real open question lives rather than just a rough edge: a plaintext connect uses the FIRST address this returns and does not fall back to the next on failure, so a host whose IPv6 route is dead fails instead of reaching its IPv4 address. There is no happy-eyeballs, and the resolver's order decides. Fixing that will change what the typed layer asks of this one.

Functions

getaddrinfo function
fn(node : *u8, service : ?*u8, hints : ?*u8, result : *?*u8) -> IoFuture

Parameters

NameTypeNotes
node*u8
service?*u8
hints?*u8
result*?*u8

Returns: IoFuture

getnameinfo function
fn(addr : *u8, addrlen : u32, host : *u8, hostlen : usize, service : *u8, servlen : usize, flags : i32) -> IoFuture

Parameters

NameTypeNotes
addr*u8
addrlenu32
host*u8
hostlenusize
service*u8
servlenusize
flagsi32

Returns: IoFuture

freeaddrinfo function
fn(res : *u8) -> unit

Parameters

NameTypeNotes
res*u8

Returns: unit

alloc_result function
fn() -> *?*u8

Returns: *?*u8

get_result function
fn(result : *?*u8) -> ?*u8

Parameters

NameTypeNotes
result*?*u8

Returns: ?*u8

free_result function
fn(result : *?*u8) -> unit

Parameters

NameTypeNotes
result*?*u8

Returns: unit

addrinfo_size function
fn() -> usize

Returns: usize

addrinfo_flags function
fn(ai : *u8) -> i32

Parameters

NameTypeNotes
ai*u8

Returns: i32

addrinfo_family function
fn(ai : *u8) -> i32

Parameters

NameTypeNotes
ai*u8

Returns: i32

fn(ai : *u8) -> i32

Parameters

NameTypeNotes
ai*u8

Returns: i32

fn(ai : *u8) -> i32

Parameters

NameTypeNotes
ai*u8

Returns: i32

addrinfo_addrlen function
fn(ai : *u8) -> u32

Parameters

NameTypeNotes
ai*u8

Returns: u32

addrinfo_addr function
fn(ai : *u8) -> *u8

Parameters

NameTypeNotes
ai*u8

Returns: *u8

fn(ai : *u8) -> ?*u8

Parameters

NameTypeNotes
ai*u8

Returns: ?*u8

addrinfo_next function
fn(ai : *u8) -> ?*u8

Parameters

NameTypeNotes
ai*u8

Returns: ?*u8

alloc_hints function
fn() -> *u8

Returns: *u8

free_hints function
fn(hints : *u8) -> unit

Parameters

NameTypeNotes
hints*u8

Returns: unit