nx_dns_resolve_a_record.nx
buildroot/runtime/nx_dns_resolve_a_record.nx
about
nx_dns_resolve_a_record.nx -- hostname → packed IPv4 glue function.
module: nishi-core.net.dns_resolve_a
depends: nishi-core.net.dns, nishi-core.io.syscalls
disk_kb: 3
capability: CORE_NET
license_tier: PUBLIC_NISHI_SUBSTRATE
genealogy_id: rfc_1035_dns_a_record +
nishi_substrate_phase_8_unblock_2026
The TINY GLUE FUNCTION that unblocks the entire NX-INGEST stack
per cardinal [[feedback-build-the-system-not-manual-output]].
Composes existing shipped substrate (nx_dns parsers + sys_socket)
into the hostname-to-packed-IPv4 function that nx_https_client
has been waiting for.
Before this primitive: every NX-INGEST adapter honest-stubs at
the network-fetch line because caller has to pass packed IPv4
manually.
After this primitive: nx_https_client wires through; adapters
run against real upstreams.
===== Algorithm ==================================================
1. Construct DNS A-record query packet via existing nx_dns
primitives (already shipped in nx_dns.nx per browser arc)
2. Send query via UDP to resolver (1.1.1.1 / 8.8.8.8 / configured)
3. Receive response
4. Parse first A-record IPv4 via existing nx_dns parse primitives
5. Return packed-i64 IPv4 (or 0 on failure)
Sovereign-egress posture per [[feedback-ethical-jurisdiction-routed-
egress]]: configurable resolver IP; defaults to local /etc/resolv
.conf parse if available, else 1.1.1.1.
dependencies 2 imports · 15 importers
diagram shows first 10 each side; +0 more imports, +5 more importers in the complete lists below.
imports: nx_syscalls.nxnx_dns.nx
imported by: nx_acme_dns01_propagation.nxnx_browser.nxnx_browser_image_demo_test.nxnx_browser_page_demo_test.nxnx_dns_probe.nxnx_dns_resolve_a_record_live_test.nxnx_golive_dns_gate.nxnx_https_url_connect.nxnx_live_crawl.nxnx_net_diag.nxnx_reach_probe.nxnx_room_live_gate.nxnx_room_perf_gate.nxnx_smtp_probe.nxnx_tls13_sh_probe_test.nx
structs
| 87 | struct DnsResolveResult |
| 251 | struct DnsCacheEntry |
consts
| 49 | const NX_DNS_R_OK: i64 = 1 |
| 50 | const NX_DNS_R_QUERY_BUILD_FAIL: i64 = 2 |
| 51 | const NX_DNS_R_SOCKET_FAIL: i64 = 3 |
| 52 | const NX_DNS_R_SEND_FAIL: i64 = 4 |
| 53 | const NX_DNS_R_RECV_FAIL: i64 = 5 |
| 54 | const NX_DNS_R_PARSE_FAIL: i64 = 6 |
| 55 | const NX_DNS_R_NO_A_RECORD: i64 = 7 // hostname has only AAAA / CNAME / etc. |
| 56 | const NX_DNS_R_NXDOMAIN: i64 = 8 |
| 57 | const NX_DNS_R_TIMEOUT: i64 = 9 |
| 74 | const NX_DNS_R_CLOUDFLARE_IP: i64 = 16843009 // 1.1.1.1 packed big-endian (1<<24 | 1<<16 | 1<<8 | 1) |
| 75 | const NX_DNS_R_GOOGLE_IP: i64 = 134744072 // 8.8.8.8 |
| 76 | const NX_DNS_R_QUAD9_IP: i64 = 151060801 // 9.9.9.1 -- actually 9.9.9.9 = 9*16777216+9*65536+9*256+9 = 151060489 |
| 82 | const NX_DNS_R_LAN_IP: i64 = 3232237569 |
| 83 | const NX_DNS_R_DNS_PORT: i64 = 53 |
| 99 | const NX_DNS_RESOLVE_RESULT_BYTES: i64 = 72 // 9 fields * 8 bytes |
| 261 | const NX_DNS_CACHE_ENTRY_BYTES: i64 = 56 // 7 fields * 8 bytes |
functions
| 59 | func nx_dns_r_verdict_name(v: i64) -> *u8 |
| 105 | func nx_dns_resolve_a_record( |
| 201 | func nx_dns_resolve_default( called by 13: nx_dns01_authoritative_ipbr_http_fetchmainmainmainnx_https_url_connect+7 calls 1: nx_dns_resolve_with_failover |
| 218 | func nx_dns_resolve_with_failover( |
| 263 | func nx_dns_cache_entry_new(result: *DnsResolveResult, now_unix: i64) -> *DnsCacheEntry calls 1: sys_mmap |
| 277 | func nx_dns_cache_is_valid(entry: *DnsCacheEntry, now_unix: i64) -> i64 |