code wiki / _hdl_build / nx_cleanview.nx

nx_cleanview.nx

buildroot/runtime/_hdl_build/nx_cleanview.nx

10925 B155 linesdepth 22pulls 176 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

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 9 imports · 0 importers

nx_syscalls.nx nx_url_safety_lib.nx nx_x509_trust_store.nx nx_trust_store_load_from_certdata. nx_https_fetch_follow.nx nx_web_filter.nx nx_clean_serve.nx nx_video_sniff.nx nx_video_sniff_fetch.nx nx_cleanview.nx

imports: nx_syscalls.nxnx_url_safety_lib.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

main sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ ncv_put ncv_write_all sys_write ↻ ncv_streq ncv_slen ncv_url_safe us_url_safe us_reason sys_mmap ↻ us_host_of us_pfx_ci us_slen us_lc us_pfx_ci ↻ nx_trust_store_load_from_c sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close nx_nss_certdata_parse

structs

none

consts

22const NCV_MAGIC_8388608: i64 = 8388608
23const NCV_MAGIC_8192: i64 = 8192
24const NCV_MAGIC_8191: i64 = 8191
25const NCV_MAGIC_2560: i64 = 2560
26const NCV_MAGIC_65536: i64 = 65536
27const NCV_MAGIC_4194304: i64 = 4194304
28const NCV_MAGIC_1048576: i64 = 1048576
29const NCV_MAGIC_4000: i64 = 4000
52const NCV_SNIFF_CPU_SECS: i64 = 5
53const NCV_SRCCAP: i64 = 65536 // buffer for the extracted <script src> list
54const NCV_EXTCAP: i64 = 2097152 // concatenated external-bundle JS (2 MiB)
55const NCV_BUNCAP: i64 = 1048576 // one bundle response (1 MiB)
56const NCV_MAXSRC: i64 = 8 // fetch at most 8 external bundles (bounded; declared)

functions

32func 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 }
called by 2: ncv_resolvemain
33func 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 }
called by 2: ncv_resolvemain calls 1: sys_mmap
34func ncv_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
called by 1: main
35func 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
36func ncv_lc2(c: i64) -> i64 { if c>=65 { if c<=90 { return c+32 } } return c }
called by 1: ncv_pfx_ci
37func 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 }
calls 1: ncv_lc2
38func 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 }
called by 2: ncv_resolvemain calls 1: sys_write
42func ncv_body_off(buf: *u8, n: i64) -> i64 { return cs_entity_body_off(buf, n) }
called by 2: ncv_resolvemain calls 1: cs_entity_body_off
47func ncv_url_safe(url: *u8, ulen: i64) -> i64
called by 1: main calls 1: us_url_safe
57func ncv_resolve(out: *u8, url: *u8, ulen: i64, store: *TrustStore) -> i64
121func main(argc: i64, argv: *i64) -> i64