code wiki / (root) / nx_netscope_diag.nx

nx_netscope_diag.nx source

↩ module page · 39 lines · 1874 B

1// nx_netscope_diag.nx -- the ONE-COMMAND, EASY-FOR-ANYONE DNS diagnosis. 2// 3// Probes the (resolver x owned-domain) matrix in PARALLEL (L1.1 poll 4// fan-in, worst-case ~one timeout not the sum) and renders the plain- 5// language, fix-attached verdict (nx_netscope_verdict.nx) -- not a raw 6// matrix. A non-engineer runs this and immediately sees whether their 7// sites resolve, why not, and exactly how to fix it. Exit 0 = all clear, 8// 2 = problem found (clig.dev, script/CI-gateable). 9// 10// Resolvers (Charter sec 2): GL-BE9300 192.168.8.1 (split-horizon -> 11// NAS .8.240), ATT BGW320 192.168.1.254, Google 8.8.8.8 (public baseline). 12// NOTE: a true per-resolver run needs Windows-native or WSL-mirrored mode; 13// inside WSL NAT every :53 query is proxied to one resolver. 14// 15// license_tier: ORIGINAL 16 17import "nx_netscope_verdict.nx" 18 19func main() -> i64 { 20 let n_servers: i64 = 3 21 let n_hosts: i64 = 2 22 let servers: *i64 = sys_mmap(n_servers * 8) as *i64 23 servers[0] = (192 << 24) | (168 << 16) | (8 << 8) | 1 // GL-BE9300 (split-horizon) 24 servers[1] = (192 << 24) | (168 << 16) | (1 << 8) | 254 // ATT BGW320 25 servers[2] = (8 << 24) | (8 << 16) | (8 << 8) | 8 // Google 8.8.8.8 (public) 26 27 let h0: *u8 = "nishifamily.com" as *u8 28 let h1: *u8 = "andelinwest.com" as *u8 29 let hosts: *i64 = sys_mmap(n_hosts * 8) as *i64 30 let host_lens: *i64 = sys_mmap(n_hosts * 8) as *i64 31 hosts[0] = h0 as i64; host_lens[0] = 15 32 hosts[1] = h1 as i64; host_lens[1] = 15 33 34 let cells: *ProbeCell = sys_mmap(n_servers * n_hosts * NXNS_PROBECELL_BYTES) as *ProbeCell 35 nx_dns_probe_matrix_parallel(servers, n_servers, hosts, host_lens, n_hosts, 800, 0x5a3c, cells) 36 37 // verdict-first plain-language render; returns the process exit code. 38 return nx_netscope_verdict_all(cells, n_servers, n_hosts, hosts, host_lens, servers) 39}