code wiki / (root) / nx_net_diag.nx

nx_net_diag.nx

buildroot/runtime/nx_net_diag.nx

8458 B136 linesdepth 5pulls 7 transitivereach 0 importersview sourcekind tooltopic net
docsdependenciesstructsconstsfunctions

about

nx_net_diag.nx -- IN-PLACE network troubleshooter (operator 2026-07-04: "we need a tracert/ping type capability so the smart fallback can troubleshoot + resolve in place"). Layers the failure so we know WHICH layer breaks instead of guessing: DNS resolve -> TCP connect -> send a BROAD browser-like TLS 1.2 ClientHello and READ exactly what the server returns (ServerHello=answered / Alert=negotiation-refused-with-reason / nothing=silent fingerprint drop). This is what cracked "ukdevilz fails but Waterfox works from the same IP": it distinguishes a network block (never happens -- DNS+TCP fine) from a TLS-fingerprint/cipher issue. usage: nx_net_diag <host> license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_dns_resolve_a_record.nx nx_net_diag.nx

imports: nx_syscalls.nxnx_connect.nxnx_dns_resolve_a_record.nx

imported by: nobody (leaf or entry point)

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

main dw sys_write slen sys_now_realtime_sec sys_mmap sys_clock_gettime_real nx_dns_resolve_default nx_dns_resolve_with_failov nx_dns_resolve_a_record sys_mmap ↻ nx_dns_build_query nx_dns_put_u16_be nx_dns_encode_name sys_socket sys_set_socket_timeout sys_mmap ↻ sys_setsockopt sys_munmap sys_sendto sys_close sys_recvfrom nx_dns_parse_response_a nx_dns_get_u16_be nx_dns_skip_name dn sys_write ↻ sys_mmap ↻ sys_socket ↻ sys_set_socket_timeout ↻ sys_mmap ↻ sockaddr sys_now_ms sys_mmap ↻ sys_clock_gettime_mono nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll

structs

none

consts

12const ND_MAGIC_1024: i64 = 1024
13const ND_MAGIC_16384: i64 = 16384
15const ND_AF_INET: i64 = 2
16const ND_SOCK_STREAM: i64 = 1

functions

18func dw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
19func dn(v: i64) -> i64 { if v==0 { sys_write(1,"0" as *u8,1); return 0 } var m: i64=v; if m<0 { sys_write(1,"-" as *u8,1); m=0-m } let t: *u8=sys_mmap(24); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } let o: *u8=sys_mmap(24); var q: i64=k-1; var x: i64=0; while q>=0 { o[x]=t[q]; x=x+1; q=q-1 } sys_write(1,o,x); return 0 }
called by 1: main calls 2: sys_writesys_mmap
20func dhx(v: i64) -> i64 { let h: *u8="0123456789abcdef" as *u8; let o: *u8=sys_mmap(6); o[0]=48 as u8; o[1]=120 as u8; o[2]=h[(v>>12)&0xF] as u8; o[3]=h[(v>>8)&0xF] as u8; o[4]=h[(v>>4)&0xF] as u8; o[5]=h[v&0xF] as u8; sys_write(1,o,6); return 0 }
called by 1: main calls 2: sys_mmapsys_write
21func slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
22func sockaddr(out: *u8, ip: i64, port: i64) -> i64
called by 1: main
28func ap(out: *u8, o: i64, b: i64) -> i64 { out[o]=b as u8; return o+1 }
called by 1: mkhello
30func mkhello(host: *u8, hl: i64, out: *u8) -> i64
called by 1: main calls 1: ap
72func main(argc: i64, argv: *i64) -> i64