code wiki / (root) / nx_external_path_audit.nx

nx_external_path_audit.nx

buildroot/runtime/nx_external_path_audit.nx

6792 B188 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic external
docsdependenciesstructsconstsfunctions

about

nx_external_path_audit.nx -- NR-1.5 of NISHI_ROUTER_CONTROL_ROADMAP. Bits-up health check for the public WAN path. Runs on the NAS (or any host with internet egress); periodically tries to TCP-connect from this host's OUTBOUND interface to its OWN public IP on :443. Logs OK / TIMEOUT / REFUSED per check + writes a verdict file the operator (or other Nishi substrate) can grep. Today's outage (2026-05-21) revealed the operator had ZERO bits-up signal that the router was dropping inbound :443. Friend reports via Waterfox console blowups are NOT a substrate signal. This is. V1 simplicity: - Hardcoded public IP (75.28.18.94) + port (443). NR-1.5b adds DNS- resolved lookup so it auto-tracks WAN IP changes. - Loops forever (5 sec interval). No daemon-level scheduling -- just run under nx_supervisor_run. - Writes one line per probe to /tmp/nx_external_path.log (path configurable via env in V2). V2 sub-stones: - NR-1.5b: resolve target via our sovereign DNS, not hardcoded IP - NR-1.5c: emit signals through D5 nx_metrics (instead of /tmp log) - NR-1.5d: per-port audit (probe :443 AND :80 AND :8443 etc) - NR-1.5e: tail-and-alert mode (push alert when verdict changes)

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_external_path_audit.nx

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

main nx_external_path_audit_run sys_openat_append _epa_w sys_write _epa_strlen _epa_wi sys_mmap sys_write ↻ sys_write ↻ _epa_strlen ↻ nx_epa_probe_once sys_socket sys_mmap ↻ _epa_build_sockaddr sys_connect sys_close sys_now_ms sys_mmap ↻ sys_clock_gettime_mono _epa_verdict_name _epa_sleep sys_mmap ↻ sys_close ↻

structs

none

consts

33const NX_EPA_TARGET_IP_A: i64 = 75
34const NX_EPA_TARGET_IP_B: i64 = 28
35const NX_EPA_TARGET_IP_C: i64 = 18
36const NX_EPA_TARGET_IP_D: i64 = 94
37const NX_EPA_TARGET_PORT: i64 = 443
39const NX_EPA_INTERVAL_SEC: i64 = 5
40const NX_EPA_CONNECT_TIMEOUT_SEC: i64 = 3
42const NX_EPA_VERDICT_OK: i64 = 0
43const NX_EPA_VERDICT_TIMEOUT: i64 = 1
44const NX_EPA_VERDICT_REFUSED: i64 = 2
45const NX_EPA_VERDICT_ERROR: i64 = 3
47const AF_INET_CONST: i64 = 2
48const SOCK_STREAM_CONST: i64 = 1

functions

52func _epa_strlen(s: *u8) -> i64
58func _epa_w(fd: i64, s: *u8) -> i64
63func _epa_wi(fd: i64, n: i64) -> i64
88func _epa_build_sockaddr(out: *u8, ip_a: i64, ip_b: i64, ip_c: i64, ip_d: i64,
called by 1: nx_epa_probe_once
107func nx_epa_probe_once() -> i64
129func _epa_verdict_name(v: i64) -> *u8
137func _epa_sleep(secs: i64) -> i64
called by 1: nx_external_path_audit_run calls 1: sys_mmap
146func nx_external_path_audit_run() -> i64
186func main() -> i64