Skip to main content

Module dns

Module dns 

Source
Expand description

DNS resolution for Seq.

Resolves hostnames to IP-address strings via libc’s getaddrinfo, offloaded onto a dedicated OS-thread pool so may-carrier threads never park on the syscall. Inherits all platform-correct resolution behaviour (/etc/hosts, systemd-resolved, VPN/corp DNS, mDNS) for free.

A small TTL cache collapses fanout to the same host. Cache and worker pool are process-global and lazy-initialised on first call.

§Surface

net.dns.resolve ( String -- List Bool ) returns a list of IP-string representations. On unresolvable name or empty result, pushes (empty-list, false).

§Known limitation: no single-flight

The cache collapses sequential fanout — repeated resolves of the same host after one has filled the cache hit the fast path. It does not deduplicate concurrent first-resolves: N strands racing to resolve the same uncached host enqueue N worker jobs, each running its own getaddrinfo and writing the cache on return. Wasted work under bursty load (e.g., connection-pool warm-up), but not a correctness issue. Single-flight via an in-flight map keyed by hostname is a planned follow-up.

Functions§

patch_seq_dns_resolve
Resolve a hostname to a list of IP-address strings.
resolve
Resolve a hostname to a list of IP-address strings.