code wiki / _hdl_build / nx_golive_dns_gate.nx
nx_golive_dns_gate.nx
buildroot/runtime/_hdl_build/nx_golive_dns_gate.nx
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
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
structs
| none |
consts
| 27 | const GD_CONF: *u8 = "knowledge/hosting/golive_dns.conf\x00" as *u8 |
functions
| 31 | func 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 } |
| 32 | func gd_write(s: *u8, n: i64) -> i64 { sys_write(1, s, n); return 0 } called by 1: gd_domain |
| 33 | func gd_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } |
| 34 | func 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 } |
| 36 | func gd_ipparse(s: *u8, n: i64) -> i64 called by 1: gd_domain |
| 46 | func gd_ip(p: i64) -> i64 |
| 50 | func gd_contains(hay: *u8, n: i64, needle: *u8) -> i64 |
| 60 | func gd_pk_has_a(resp: *u8, rn: i64, fqdn: *u8, fqn: i64, ip: *u8, ipn: i64) -> i64 |
| 100 | func gd_creds(ak: *i64, akn: *i64, sk: *i64, skn: *i64) -> i64 called by 1: main |
| 118 | func gd_lan_is(host: *u8, want: i64) -> i64 |
| 126 | func gd_serve(ip: i64, host: *u8, store: *TrustStore) -> i64 called by 1: gd_domain calls 8: gd_slensys_socketsys_set_socket_timeoutnx_connect_boundednx_csprng_fillsys_now_realtime_sec+2 |
| 156 | func gd_check_line(tag: *u8, ok: i64, fixhint: *u8) -> i64 |
| 164 | func gd_domain(line: *u8, ln: i64, store: *TrustStore, have_pk: i64, ak: *u8, akn: i64, sk: *u8, skn: i64) -> i64 called by 1: main calls 10: gd_ipparsegd_putsgd_writegd_putnnx_porkbun_retrievesys_now_realtime_sec+4 |
| 248 | func main() -> i64 |