code wiki / _hdl_build / nx_cleanview.nx
nx_cleanview.nx
buildroot/runtime/_hdl_build/nx_cleanview.nx
about
nx_cleanview.nx -- one-shot CLI face of the ethical clean-serve engine, exposed as an MCP tool (nx_cleanview).
TWO modes:
nx_cleanview <url> -> the machine-readable SAFETY RECEIPT JSON (attacks neutralized + safe ads kept).
nx_cleanview resolve <url> -> F108d: sovereign GUARDED JS-EXEC media resolution. Fetches the page over the
SAME _best (Chrome-JA3) path clean-serve uses, then runs the page's inline JS
through the guarded sniff (fork + CPU/mem cap, NO network in the child) to
surface the runtime-constructed stream URL (VSK_HLS/DIRECT). This is the
_best-HTML-passthrough integration design (do NOT re-fetch with a weaker path).
External-<script src> _best-fetch enrichment = the next rung.
Shares the daemon's exact clean core (cs_clean_page / cs_receipt_json) so the receipt can NEVER drift from /receipt.
SSRF-guarded by construction (public http(s) only). Read-only, no persistent state, safe to fork-exec per call.
license_tier: ORIGINAL
dependencies 8 imports · 0 importers
imports: nx_syscalls.nxnx_x509_trust_store.nxnx_trust_store_load_from_certdata.nxnx_https_fetch_follow.nxnx_web_filter.nxnx_clean_serve.nxnx_video_sniff.nxnx_video_sniff_fetch.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
| 21 | const NCV_MAGIC_8388608: i64 = 8388608 |
| 22 | const NCV_MAGIC_8192: i64 = 8192 |
| 23 | const NCV_MAGIC_8191: i64 = 8191 |
| 24 | const NCV_MAGIC_2560: i64 = 2560 |
| 25 | const NCV_MAGIC_65536: i64 = 65536 |
| 26 | const NCV_MAGIC_4194304: i64 = 4194304 |
| 27 | const NCV_MAGIC_1048576: i64 = 1048576 |
| 28 | const NCV_MAGIC_4000: i64 = 4000 |
| 66 | const NCV_SNIFF_CPU_SECS: i64 = 5 |
| 67 | const NCV_SRCCAP: i64 = 65536 // buffer for the extracted <script src> list |
| 68 | const NCV_EXTCAP: i64 = 2097152 // concatenated external-bundle JS (2 MiB) |
| 69 | const NCV_BUNCAP: i64 = 1048576 // one bundle response (1 MiB) |
| 70 | const NCV_MAXSRC: i64 = 8 // fetch at most 8 external bundles (bounded; declared) |
functions
| 31 | func ncv_put(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[off]=s[i];off=off+1;i=i+1} return off } |
| 32 | func ncv_putn(dst: *u8, off: i64, v: i64) -> i64 { var m: i64=v; if m==0 { dst[off]=48 as u8; return off+1 } 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 } var j: i64=0; while j<k { dst[off]=t[k-1-j]; off=off+1; j=j+1 } return off } |
| 33 | func ncv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: main |
| 34 | func ncv_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8){ if a[i]!=b[i] { return 0 } i=i+1 } if b[i]!=(0 as u8) { return 0 } return 1 } called by 1: main |
| 35 | func ncv_lc2(c: i64) -> i64 { if c>=65 { if c<=90 { return c+32 } } return c } called by 1: ncv_pfx_ci |
| 36 | func ncv_pfx_ci(s: *u8, sl: i64, p: *u8) -> i64 { var i: i64=0; while p[i]!=(0 as u8) { if i>=sl { return 0 } if ncv_lc2(s[i]&0xff)!=ncv_lc2(p[i]&0xff) { return 0 } i=i+1 } return 1 } |
| 37 | func ncv_write_all(fd: i64, buf: *u8, n: i64) -> i64 { var off: i64=0; while off<n { let w: i64=sys_write(fd, ((buf as i64)+off) as *u8, n-off); if w<=0 { return off } off=off+w } return off } |
| 39 | func ncv_body_off(buf: *u8, n: i64) -> i64 |
| 44 | func ncv_url_safe(url: *u8, ulen: i64) -> i64 |
| 71 | func ncv_resolve(out: *u8, url: *u8, ulen: i64, store: *TrustStore) -> i64 |
| 135 | func main(argc: i64, argv: *i64) -> i64 |