nx_source_health.nx
buildroot/runtime/nx_source_health.nx
about
nx_source_health.nx -- SOURCE HEALTH, THE DECISION + THE PERSISTED VERDICT (/compare/mediaingest R1; contract
symbol sh_preflight). LIB: pure classification + a tiny per-host verdict table. The heavy I/O probe (fetch +
bot-wall classify) lives in the thin program nx_source_health_probe so THIS lib's import closure stays small
(nx_syscalls only) and the gate can prove every branch with planted numbers -- the same lib/program split that
keeps a gate honest and dodges the nx_cc module-limit that a fetch+antibot closure would hit here.
WHY: Harvestr fast-fails a null-routed CDN (its April-2026 Coomer route-around) before queueing work against it;
ours had nx_site_liveness for OUR sites only. This is the general per-host pre-flight: probe once, PERSIST the
verdict, and let every capture read it so a dead host is skipped WITHOUT re-probing on every asset.
FIVE STATES (a host that cannot be classified must not read as UP -- abstain, never flatter):
SH_UP the host answered (any 2xx/3xx, or a 4xx/5xx where the HOST is alive but the path is bad)
SH_SLOW it answered but slower than the slow bar -- usable, flagged
SH_DEAD connect failed / timed out -- null-routed or down; skip and say so
SH_WALLED it answered with a bot-wall (nx_antibot verdict) -- classified, never solved
SH_UNKNOWN never probed / stale -- the third state, so "no evidence" is not "healthy"
license_tier: ORIGINAL
dependencies 1 imports · 3 importers
imports: nx_syscalls.nx
imported by: nx_cam_chaturbate_probe.nxnx_source_health_gate.nxnx_source_health_probe.nx
structs
| none |
consts
| 20 | const SH_UP: i64 = 0 |
| 21 | const SH_SLOW: i64 = 1 |
| 22 | const SH_DEAD: i64 = 2 |
| 23 | const SH_WALLED: i64 = 3 |
| 24 | const SH_UNKNOWN: i64 = 4 |
| 27 | const SH_DEFAULT_SLOW_MS: i64 = 8000 |
| 29 | const SH_DEFAULT_TTL_MS: i64 = 1800000 |
| 30 | const SH_SLOW_CONF: *u8 = "knowledge/status/source_health_slow_ms.conf" |
| 31 | const SH_TABLE: *u8 = "knowledge/status/source_health.tbl" |
| 34 | const SH_ABT_CLEAN: i64 = 0 |
| 84 | const SH_SLOTS: i64 = 4096 |
| 85 | const SH_REC: i64 = 32 |
| 86 | const SH_TBL_BYTES: i64 = 131072 // SH_SLOTS * SH_REC |
| 87 | const SH_OFF_HASH: i64 = 0 |
| 88 | const SH_OFF_VERDICT: i64 = 8 |
| 89 | const SH_OFF_CHECKED: i64 = 16 |
| 90 | const SH_MAGIC_5381: i64 = 5381 |
functions
| 39 | func sh_decide(connect_ok: i64, status: i64, elapsed_ms: i64, wall_code: i64, slow_ms: i64) -> i64 |
| 47 | func sh_verdict_str(v: i64) -> *u8 |
| 57 | func sh_should_skip(v: i64) -> i64 |
| 64 | func sh_atoi(s: *u8, n: i64) -> i64 called by 1: sh_slow_ms |
| 70 | func sh_slow_ms() -> i64 |
| 92 | func sh_hash(h: *u8, n: i64) -> i64 |
| 98 | func sh_ld(tbl: *u8, off: i64) -> i64 { var v: i64=0; var i: i64=0; while i<8 { v = v | ((tbl[off+i] as i64) << (i*8)); i=i+1 } return v } |
| 99 | func sh_st(tbl: *u8, off: i64, val: i64) -> i64 { var i: i64=0; while i<8 { tbl[off+i] = ((val >> (i*8)) & 0xff) as u8; i=i+1 } return 0 } called by 1: sh_record |
| 101 | func sh_load_tbl_into(dst: *u8) -> i64 |
| 111 | func sh_load_tbl() -> *u8 { let d: *u8 = sys_mmap(SH_TBL_BYTES); sh_load_tbl_into(d); return d } |
| 112 | func sh_save_tbl(tbl: *u8) -> i64 |
| 121 | func sh_slot(tbl: *u8, hh: i64) -> i64 |
| 142 | func sh_record(host: *u8, host_len: i64, verdict: i64, now_ms: i64) -> i64 |
| 161 | func sh_preflight(host: *u8, host_len: i64, connect_ok: i64, status: i64, elapsed_ms: i64, wall_code: i64, now_ms: i64) -> i64 |
| 168 | func sh_lookup(host: *u8, host_len: i64, now_ms: i64) -> i64 |