code wiki / (root) / nx_dns_resolve_a_record.nx

nx_dns_resolve_a_record.nx

buildroot/runtime/nx_dns_resolve_a_record.nx

11877 B282 linesdepth 2pulls 3 transitivereach 503 importersview sourcekind librarytopic dns
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_dns.nx nx_dns_resolve_a_record.nx nx_acme_dns01_propagation.nx nx_browser.nx nx_browser_image_demo_test.nx nx_browser_page_demo_test.nx nx_dns_probe.nx nx_dns_resolve_a_record_live_test. nx_golive_dns_gate.nx nx_https_url_connect.nx nx_live_crawl.nx nx_net_diag.nx

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

87struct DnsResolveResult
251struct DnsCacheEntry

consts

49const NX_DNS_R_OK: i64 = 1
50const NX_DNS_R_QUERY_BUILD_FAIL: i64 = 2
51const NX_DNS_R_SOCKET_FAIL: i64 = 3
52const NX_DNS_R_SEND_FAIL: i64 = 4
53const NX_DNS_R_RECV_FAIL: i64 = 5
54const NX_DNS_R_PARSE_FAIL: i64 = 6
55const NX_DNS_R_NO_A_RECORD: i64 = 7 // hostname has only AAAA / CNAME / etc.
56const NX_DNS_R_NXDOMAIN: i64 = 8
57const NX_DNS_R_TIMEOUT: i64 = 9
74const NX_DNS_R_CLOUDFLARE_IP: i64 = 16843009 // 1.1.1.1 packed big-endian (1<<24 | 1<<16 | 1<<8 | 1)
75const NX_DNS_R_GOOGLE_IP: i64 = 134744072 // 8.8.8.8
76const NX_DNS_R_QUAD9_IP: i64 = 151060801 // 9.9.9.1 -- actually 9.9.9.9 = 9*16777216+9*65536+9*256+9 = 151060489
82const NX_DNS_R_LAN_IP: i64 = 3232237569
83const NX_DNS_R_DNS_PORT: i64 = 53
99const NX_DNS_RESOLVE_RESULT_BYTES: i64 = 72 // 9 fields * 8 bytes
261const NX_DNS_CACHE_ENTRY_BYTES: i64 = 56 // 7 fields * 8 bytes

functions

59func nx_dns_r_verdict_name(v: i64) -> *u8
105func nx_dns_resolve_a_record(
201func nx_dns_resolve_default(
218func nx_dns_resolve_with_failover(
263func nx_dns_cache_entry_new(result: *DnsResolveResult, now_unix: i64) -> *DnsCacheEntry
calls 1: sys_mmap
277func nx_dns_cache_is_valid(entry: *DnsCacheEntry, now_unix: i64) -> i64