Skip to content

std.net.dns

hosts file + A queries over udp; std.net.resolve’s path on linux (no libc)

pub build_query :: fn(host: []const u8, id: u16, out: []u8) -> usize

A-record query for host into out (512 bytes suffice); len, 0 if the name is invalid

pub parse_answer :: fn(msg: []const u8, id: u16) -> ?IpV4

first A record answering query id; null on id mismatch, error, or no A record

pub from_hosts :: fn(text: []const u8, name: []const u8) -> ?IpV4

address of name in hosts-file text, or null

pub servers :: fn(text: []const u8, out: []IpV4) -> usize

ipv4 nameservers from resolv.conf text, up to out.len