code wiki / (root) / nx_dns_io.nx

nx_dns_io.nx

buildroot/runtime/nx_dns_io.nx

5523 B126 linesdepth 4pulls 5 transitivereach 1 importersview sourcekind librarytopic dns
docsdependenciesstructsconstsfunctions

about

nx_dns_io.nx -- live UDP-composed DNS stub resolver (x86_64). Phase 0a completion brick: composes the pure-byte primitives in nx_dns.nx with the sovereign UDP transport in nx_udp.nx into a single callable `nx_dns_io_resolve_a(...)`. This is the byte that turns DNS from "we have a parser" into "we can actually resolve example.com over the wire." Architecture pinning: this module uses Linux x86_64 syscalls (sys_socket / sys_sendto / sys_recvfrom). Running it under qemu-riscv64 would need the RV64 socket-syscall wrappers, which aren't shipped in nx_syscalls.nx yet (queued separately as the "RV64 socket parity" brick). Live smokes run via the x86_64 native path with nxc2's --target x86_64. What it does today: - opens a UDP socket - builds an A-record query from a hostname using nx_dns_build_query - sends it to a caller-supplied IPv4 resolver on port 53 (or any port) - reads ONE response packet - parses + extracts the first A record into out4 - returns a sealed verdict What it doesn't do yet: - SO_RCVTIMEO bind for bounded blocking (next iteration, ~20 LOC) - retry-on-timeout (RFC 1035 recommends 5s initial, doubling) - parallel queries to multiple resolvers (Happy Eyeballs for DNS) - CNAME chase (caller-level retry until verdict != CNAME) - TC=1 -> TCP fallback (Phase 0b dependency) - DoH / DoT (queued behind TLS audit) Composes with: - nx_udp -- sovereign UDP transport - nx_dns -- pure parse/build primitives - nx_csprng -- caller supplies tx_id from nx_csprng_u64 per RFC 5452 license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_1035 + ietf/rfc_5452 lineage_id: nishi_browser_dns_resolver_io_q10

dependencies 3 imports · 1 importers

nx_syscalls_x86_64.nx nx_udp.nx nx_dns.nx nx_dns_io.nx _inet_naive_probe.nx

imports: nx_syscalls_x86_64.nxnx_udp.nxnx_dns.nx

imported by: _inet_naive_probe.nx

structs

none

consts

67const NX_DNS_IO_VERDICT_OK: i64 = 1 // == NX_DNS_VERDICT_OK
68const NX_DNS_IO_VERDICT_SOCKET_FAIL: i64 = 100
69const NX_DNS_IO_VERDICT_SEND_FAIL: i64 = 102
70const NX_DNS_IO_VERDICT_RECV_FAIL: i64 = 103
71const NX_DNS_IO_VERDICT_BUILD_FAIL: i64 = 104
72const NX_DNS_IO_VERDICT_SHORT_RESP: i64 = 105
77const NX_DNS_IO_BUF: i64 = 1024

functions

87func nx_dns_io_resolve_a(
121func nx_dns_io_verdict_is_valid(v: i64) -> i64