code wiki / _hdl_build / nx_golive_dns_gate.nx

nx_golive_dns_gate.nx

buildroot/runtime/_hdl_build/nx_golive_dns_gate.nx

14442 B292 linesdepth 21pulls 137 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_golive_dns_gate.nx -- GO-LIVE GATE: every hosted domain must be testable INTERNALLY and EXTERNALLY, by construction, so the "apex works but admin.<domain> is insecure on WiFi" class (2026-07-04/05 andelinwest arc) can never ship again. Data-driven from knowledge/hosting/golive_dns.conf (domain|public_ip|lan_ip|lan_wildcard). Per domain: [A] EXTERNAL AUTHORITY -- Porkbun API (sovereign TLS, uninterceptable): apex A == public_ip AND '*.domain' A == public_ip => any subdomain reaches the edge from the internet. [B] INTERNAL LAN -- query the LAN router (dnsmasq) directly: apex -> lan_ip; and when lan_wildcard=1 a CANARY subdomain (nx-golive-canary.<domain>) -> lan_ip. The canary is the whole point: per-host override lists pass apex/www and silently miss new subdomains; only a whole-domain wildcard answers a name nobody registered. [C] EDGE SERVE -- TLS 1.3 to lan_ip:443 with SNI apex (+ canary when lan_wildcard=1): served cert must VALIDATE for that SNI (chain + SAN + validity vs Mozilla store) and GET / must return HTTP 2xx/3xx => sni_router -> cert-select -> proxy -> daemon serve the whole domain. Every RED prints its exact remediation command. Exit 0 = all GREEN, 1 = any RED. Honest limit: true external-vantage serving (hairpin-free) still needs one off-LAN check (cellular funcheck row); [A]+[C] are the strongest in-LAN-provable superset. usage: nx_golive_dns_gate (run nx_secret_cli get porkbun first -> /tmp/nxsecret.out) license_tier: ORIGINAL

dependencies 7 imports · 0 importers

nx_acme_porkbun.nx nx_connect.nx nx_dns_resolve_a_record.nx nx_csprng.nx nx_tls13_client_session.nx nx_tls13_client_session_run.nx nx_https_get_complete.nx nx_golive_dns_gate.nx

imports: nx_acme_porkbun.nxnx_connect.nxnx_dns_resolve_a_record.nxnx_csprng.nxnx_tls13_client_session.nxnx_tls13_client_session_run.nxnx_https_get_complete.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gd_puts nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id sys_mmap ↻

structs

none

consts

27const GD_CONF: *u8 = "knowledge/hosting/golive_dns.conf\x00" as *u8

functions

31func gd_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
32func gd_write(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 }
called by 1: gd_domain
33func gd_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
34func gd_putn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{m=0-m;sys_write(1,"-" as *u8,1)} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 3: gd_ipgd_domainmain
36func gd_ipparse(s: *u8, n: i64) -> i64
called by 1: gd_domain
46func gd_ip(p: i64) -> i64
calls 2: gd_putngd_puts
50func gd_contains(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: gd_pk_has_a calls 1: gd_slen
60func gd_pk_has_a(resp: *u8, rn: i64, fqdn: *u8, fqn: i64, ip: *u8, ipn: i64) -> i64
called by 1: gd_domain calls 1: gd_contains
100func gd_creds(ak: *i64, akn: *i64, sk: *i64, skn: *i64) -> i64
called by 1: main
118func gd_lan_is(host: *u8, want: i64) -> i64
126func gd_serve(ip: i64, host: *u8, store: *TrustStore) -> i64
156func gd_check_line(tag: *u8, ok: i64, fixhint: *u8) -> i64
called by 1: gd_domain calls 1: gd_puts
164func gd_domain(line: *u8, ln: i64, store: *TrustStore, have_pk: i64, ak: *u8, akn: i64, sk: *u8, skn: i64) -> i64
248func main() -> i64