code wiki / _hdl_build / nx_web_filter.nx
nx_web_filter.nx
buildroot/runtime/_hdl_build/nx_web_filter.nx
about
nx_web_filter.nx -- SOVEREIGN content-filter engine for the Nishi browser (uBlock-class, DATA-DRIVEN). The
honest defense for "these sites are full of viruses": block the malvertising / trackers / crypto-miners /
popunders that hostile (pirate/adult) sites load, and PASS THROUGH the actual video the user came to watch.
It is the DEFENSIVE TWIN of nx_media_signal/nx_extract_heal: same data-driven pattern-table shape, but the
verdict is BLOCK/ALLOW instead of media-kind. Network-level request filtering (not DOM cosmetic hiding) is
ALSO anti-adblock-resistant by construction -- it leaves no hidden-element DOM fingerprint for the site to
detect. Rules are DATA so the blocklist adapts without code edits (same as the self-heal table). ORIGINAL
dependencies 2 imports · 6 importers
imports: nx_syscalls.nxnx_media_signal.nx
imported by: nx_clean_serve.nxnx_clean_serve_daemon.nxnx_clean_serve_gate.nxnx_cleanview.nxnx_cleanwatch_serve.nxnx_web_filter_gate.nx
structs
| none |
consts
| 11 | const WF_STRIDE: i64 = 4 // per-rule: [kind, pat_ptr, patlen, category] |
| 12 | const WF_MAX: i64 = 4096 |
| 13 | const WF_BLOCK: i64 = 1 |
| 14 | const WF_ALLOW: i64 = 2 // exception: the CONTENT the user wants -- always passes |
| 16 | const WF_AD: i64 = 1 |
| 17 | const WF_TRACK: i64 = 2 |
| 18 | const WF_MAL: i64 = 3 |
| 19 | const WF_MINER: i64 = 4 |
| 20 | const WF_POPUP: i64 = 5 |
| 21 | const WF_CONTENT: i64 = 6 |
functions
| 23 | func wf_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n } called by 1: wf_addc |
| 24 | func wf_new() -> *i64 { let t: *i64 = sys_mmap(8 * (1 + WF_MAX * WF_STRIDE)) as *i64; t[0] = 0; return t } |
| 25 | func wf_add(t: *i64, kind: i64, pat: *u8, patlen: i64, cat: i64) -> i64 |
| 32 | func wf_addc(t: *i64, kind: i64, pat: *u8, cat: i64) -> i64 { return wf_add(t, kind, pat, wf_slen(pat), cat) } |
| 35 | func wf_add_list(t: *i64, cat: i64, s: *u8) -> i64 |
| 51 | func wf_seed(t: *i64) -> i64 |
| 71 | func wf_should_block(t: *i64, url: *u8, ul: i64, out_cat: *i64) -> i64 |
| 88 | func wf_cat_name(c: i64) -> *u8 |