code wiki / (root) / nx_funcheck.nx

nx_funcheck.nx

buildroot/runtime/nx_funcheck.nx

23457 B363 linesdepth 19pulls 130 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_funcheck.nx -- SOVEREIGN FUNCTIONAL HEALTH MONITOR (synthetic-transaction checks). Operator 2026-06-29: "build capabilities so we never manually debug -- focus on getting sites up and KEEPING them up." This is the VALIDATION half of the reliability loop: it drives the REAL user flows (homepage, gallery login page, the gallery/video AUTH POST, wiki, torrent) over the sovereign TLS1.3 client and reports PASS/FAIL per check, distinguishing the THREE failure modes a status-code check is blind to: CONN-FAIL : TCP connect failed -> backend down / unreachable (= the browser's "Failed to fetch") NO-RESPONSE: connected+TLS ok, no HTTP reply -> proxy hang / reset (= the browser's "Failed to fetch") EXPECT-MISS: HTTP reply, but the expected content signature is absent (= a 404/500 served as 200, etc.) Data-driven: each check is a row in knowledge/hosting/funcchecks.conf (name|method|url|path|expect|body). Add a flow = add a row. Reused by deploy-gating (block/rollback a deploy that breaks a flow) + the keep-up loop (FAIL -> auto-heal: reconcile/restart/rollback). Exit 0 iff ALL flows pass. license_tier: ORIGINAL

dependencies 12 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_connect.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_tls13_client_validate_certifica nx_tls13_client_session_run.nx nx_https_url_for_fetch.nx nx_https_url_connect.nx nx_https_get_complete.nx nx_funcheck.nx

diagram shows first 10 each side; +2 more imports, +0 more importers in the complete lists below.

imports: nx_syscalls.nxnx_itoa_lib.nxnx_connect.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_tls13_client_validate_certificate.nxnx_tls13_client_session_run.nxnx_https_url_for_fetch.nxnx_https_url_connect.nxnx_https_get_complete.nxnx_https_post_complete.nxnx_websocket_client_upgrade.nx

imported by: nobody (leaf or entry point)

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

main nx_trust_store_load_from_c sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_nss_certdata_parse sys_mmap ↻ _pat_class_cert _pat_value_octal _pat_end _find_newline _starts_with _parse_octal_line sys_mmap ↻ _is_space _decode_octal_escape _is_octal trust_store_alloc sys_mmap ↻ nx_x509_trust_store_load sys_mmap ↻ x509_parse sys_mmap ↻ asn1_cursor_init asn1_expect_tag sys_mmap ↻ asn1_read_tlv_header asn1_read_tag asn1_read_length asn1_read_length ↻ x509_read_tlv sys_mmap ↻ asn1_expect_tag ↻ x509_read_alg_id sys_mmap ↻ asn1_expect_tag ↻

structs

none

consts

24const FC_MAGIC_4096: i64 = 4096
25const FC_MAGIC_65536: i64 = 65536
26const FC_MAGIC_16645: i64 = 16645
27const FC_MAGIC_2592000: i64 = 2592000
28const FC_MAGIC_10368000: i64 = 10368000
29const FC_MAGIC_34560000: i64 = 34560000
30const FC_MAGIC_4194304: i64 = 4194304
31const FC_MAGIC_1024: i64 = 1024
32const FC_MAGIC_8192: i64 = 8192
38const FC_TIMEOUT_S: i64 = 15

functions

39func fc_puts(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 2: fc_onemain calls 1: sys_write
44func fc_putn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 2: fc_onemain calls 1: nxi_out
45func fc_strlen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 2: fc_containsfc_one
46func fc_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v }
called by 1: main
47func fc_contains(hay: *u8, n: i64, needle: *u8) -> i64
called by 1: fc_one calls 1: fc_strlen
52func fc_eol(b: *u8, n: i64, st: i64) -> i64 { var i: i64=st; while i<n { if (b[i] as i64)==10 {return i} i=i+1 } return n }
called by 1: main
53func fc_split_pipe(b: *u8, ls: i64, le: i64, offs: *i64, lens: *i64, maxf: i64) -> i64
called by 1: main
58func fc_copyz(dst: *u8, src: *u8, off: i64, len: i64) -> i64 { var i: i64=0; while i<len{dst[i]=src[off+i];i=i+1} dst[len]=0 as u8; return len }
called by 1: main
61func fcl_apps(b: *u8, n: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){b[n+i]=s[i];i=i+1} return n+i }
called by 1: main
62func fcl_appn(b: *u8, n: i64, v: i64) -> i64
called by 1: main calls 1: sys_mmap
72func fc_ws_probe(s: *Tls13ClientSession, fd: i64, host: *u8, hlen: i64, path: *u8, plen: i64) -> i64
120func fc_diag_expiry(store: *TrustStore, url: *u8, back_seconds: i64) -> i64
145func fc_hdr_location(buf: *u8, n: i64, out: *u8) -> i64
called by 1: fc_one
172func fc_parse_ip(s: *u8) -> i64
called by 1: fc_one
189func fc_connect_explicit(packed: i64, port: i64, fd_p: *i64) -> i64
202func fc_one(store: *TrustStore, name: *u8, method: *u8, url: *u8, path: *u8, expect: *u8, body: *u8, tmo_s: i64, connect_ip: *u8) -> i64
305func main() -> i64