nx_netdiag.nx
buildroot/runtime/bin/nx_netdiag.nx
about
nx_netdiag.nx -- sovereign NishiLang network path diagnostic.
Substrate-honesty principle (same as nx_wire_logger): any time we'd
reach for ping/curl/traceroute to ask "can I reach X, and how fast?",
we owe ourselves a native primitive. This does BOUNDED non-blocking
TCP-connect probes (via sys_poll) to a small table of candidate paths,
classifies each CONNECTED(ms) / TIMEOUT / REFUSED, and prints a
one-screen verdict + fix in a SINGLE run -- the 10-second / 3-step
answer to "why is it shit on LAN and fine on the internet?".
No external tools. Composes only nx_syscalls (socket/connect/poll).
license_tier: ORIGINAL
lineage_id: nishi_netdiag_q10
dependencies 1 imports · 0 importers
imports: nx_syscalls.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
| 17 | const ND_AF_INET: i64 = 2 |
| 18 | const ND_SOCK_NB: i64 = 2049 // SOCK_STREAM(1) | SOCK_NONBLOCK(0o4000=2048) |
| 19 | const ND_POLLOUT: i64 = 4 |
| 20 | const ND_POLLERR: i64 = 8 |
| 21 | const ND_POLLHUP: i64 = 16 |
| 23 | const ND_TIMEOUT: i64 = 0 - 1 |
| 24 | const ND_REFUSED: i64 = 0 - 2 |
| 25 | const ND_SOCKFAIL: i64 = 0 - 3 |
| 26 | const ND_DEBUG: i64 = 0 |
| 27 | const ND_SYS_POLL: i64 = 7 // x86_64 poll(2); netdiag is x86_64-only, so pin it |
functions
| 29 | func nd_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != 0 { n = n + 1 } return n } called by 1: nd_puts |
| 30 | func nd_puts(s: *u8) -> i64 { sys_write(1, s, nd_slen(s)); return 0 } |
| 31 | func nd_putdec(v: i64) -> i64 |
| 46 | func nd_make_sockaddr(out: *u8, a: i64, b: i64, c: i64, d: i64, port: i64) -> i64 called by 1: nd_tcp_probe |
| 62 | func nd_tcp_probe(a: i64, b: i64, c: i64, d: i64, port: i64, timeout_ms: i64) -> i64 |
| 115 | func nd_report(label: *u8, r: i64) -> i64 |
| 128 | func main() -> i64 |