std.net.dns
hosts file + A queries over udp; std.net.resolve’s path on linux (no libc)
build_query
Section titled “build_query”pub build_query :: fn(host: []const u8, id: u16, out: []u8) -> usizeA-record query for host into out (512 bytes suffice); len, 0 if the name is invalid
parse_answer
Section titled “parse_answer”pub parse_answer :: fn(msg: []const u8, id: u16) -> ?IpV4first A record answering query id; null on id mismatch, error, or no A record
from_hosts
Section titled “from_hosts”pub from_hosts :: fn(text: []const u8, name: []const u8) -> ?IpV4address of name in hosts-file text, or null
servers
Section titled “servers”pub servers :: fn(text: []const u8, out: []IpV4) -> usizeipv4 nameservers from resolv.conf text, up to out.len