nx_ignored_host_reach.nx source
↩ module page · 200 lines · 8458 B
1// nx_ignored_host_reach.nx -- SREACH R3a-seed: IGNORED-HOST REACH CENSUS.
2//
3// module: nishi-core.search.ignored_host_reach
4// depends: nx_guarded_run.nx (hang-proof child fetches),
5// /tmp/_dlr_fetch_one.sov.elf (sovereign validated-HTTPS fetch unit)
6// capability: GATE + EVIDENCE
7//
8// OPERATOR (2026-06-10): "make sure our site will hit ignored sites like
9// vk.com bunkr.ci etc" + the content-neutrality charter (no dead-internet
10// walls; the user judges value). Mainstream engines deindex / bury whole host
11// classes: foreign-locale social (vk.com, ok.ru), file/media hosts (bunkr.ci),
12// independent video (rumble, bitchute), forums, archives. This census proves
13// OUR stack -- our DNS + TCP + TLS1.3 + X509 + html->text -- REACHES that
14// class: each host fetched as a deadline-bounded child (a hang is reaped,
15// never a wedge), result recorded per host with a text excerpt so a bot-wall
16// is NAMED EVIDENCE (never silently dropped, never faked as reached).
17//
18// GATE = at least NX_IH_GATE_MIN hosts fetched OK. Bar rationale (Rule #11):
19// 3 of 8 proves the CLASS is reachable through our pipeline even when several
20// individual hosts bot-wall or hang on a given run -- walls are findings, not
21// failures of our stack. Durable rows -> knowledge/status/search_ignored_hosts.log.
22
23import "nx_str.nx"
24import "nx_syscalls.nx"
25import "nx_guarded_run.nx"
26const NX_MAGIC_524288: i64 = 524288
27
28const NX_IH_HOSTS: i64 = 8
29const NX_IH_DEADLINE: i64 = 18000
30const NX_IH_GATE_MIN: i64 = 3
31const NX_IH_EXCERPT: i64 = 120
32
33func ihp(s: *u8) -> i64 { sys_write(1, s, nx_str_len(s)); return 0 }
34func ihn(v: i64) -> i64 {
35 if v == 0 { sys_write(1, "0" as *u8, 1); return 0 }
36 var m: i64 = v; if m < 0 { sys_write(1, "-" as *u8, 1); m = 0 - m }
37 let t: *u8 = sys_mmap(28); var k: i64 = 0
38 while m > 0 { t[k] = 0x30 + (m - (m/10)*10); m = m/10; k = k + 1 }
39 while k > 0 { k = k - 1; sys_write(1, (((t as i64)+k) as *u8), 1) }
40 return 0
41}
42func ihf(fd: i64, s: *u8) -> i64 { sys_write(fd, s, nx_str_len(s)); return 0 }
43func ihfn(fd: i64, v: i64) -> i64 {
44 let b: *u8 = sys_mmap(28); let t: *u8 = sys_mmap(28)
45 var m: i64 = v; if m < 0 { m = 0 - m }
46 var k: i64 = 0
47 if m == 0 { t[0] = 48; k = 1 }
48 while m > 0 { t[k] = 48 + (m % 10); m = m / 10; k = k + 1 }
49 var i: i64 = 0
50 while i < k { b[i] = t[k-1-i]; i = i + 1 }
51 sys_write(fd, b, k)
52 return 0
53}
54
55// the incumbent-ignored host classes (operator-named anchors first)
56func ih_url(e: i64) -> *u8 {
57 if e == 0 { return "https://vk.com/" } // RU social (operator-named)
58 if e == 1 { return "https://bunkr.ci/" } // file/media host (operator-named)
59 if e == 2 { return "https://ok.ru/" } // RU social
60 if e == 3 { return "https://rumble.com/" } // independent video
61 if e == 4 { return "https://t.me/s/telegram" } // Telegram public channel (plain HTML)
62 if e == 5 { return "https://www.bitchute.com/" } // independent video
63 if e == 6 { return "https://archive.ph/" } // archive (known bot-waller)
64 if e == 7 { return "https://boards.4chan.org/po/" } // forum board (plain HTML)
65 return "?"
66}
67func ih_class(e: i64) -> *u8 {
68 if e == 0 { return "foreign-social" }
69 if e == 1 { return "file-host" }
70 if e == 2 { return "foreign-social" }
71 if e == 3 { return "indep-video" }
72 if e == 4 { return "messenger-public" }
73 if e == 5 { return "indep-video" }
74 if e == 6 { return "archive" }
75 if e == 7 { return "forum" }
76 return "?"
77}
78func ih_out(e: i64) -> *u8 {
79 if e == 0 { return "/tmp/ih_text_0.txt\x00" }
80 if e == 1 { return "/tmp/ih_text_1.txt\x00" }
81 if e == 2 { return "/tmp/ih_text_2.txt\x00" }
82 if e == 3 { return "/tmp/ih_text_3.txt\x00" }
83 if e == 4 { return "/tmp/ih_text_4.txt\x00" }
84 if e == 5 { return "/tmp/ih_text_5.txt\x00" }
85 if e == 6 { return "/tmp/ih_text_6.txt\x00" }
86 if e == 7 { return "/tmp/ih_text_7.txt\x00" }
87 return "/tmp/ih_text_x.txt\x00"
88}
89
90func ih_read_all(path: *u8, buf: *u8, cap: i64) -> i64 {
91 let fd: i64 = sys_openat_rd(path)
92 if fd < 0 { return 0 }
93 var total: i64 = 0
94 var go: i64 = 1
95 while go == 1 {
96 let n: i64 = sys_read(fd, (((buf as i64) + total) as *u8), cap - total)
97 if n <= 0 { go = 0 }
98 if n > 0 { total = total + n; if total >= cap { go = 0 } }
99 }
100 sys_close(fd)
101 return total
102}
103
104// write up to NX_IH_EXCERPT sanitized text bytes (controls -> space) to fd
105func ih_excerpt(fd: i64, text: *u8, tl: i64) -> i64 {
106 var n: i64 = tl
107 if n > NX_IH_EXCERPT { n = NX_IH_EXCERPT }
108 let clean: *u8 = sys_mmap(NX_IH_EXCERPT + 4)
109 var i: i64 = 0
110 while i < n {
111 var c: i64 = text[i] as i64
112 if c < 0x20 { c = 0x20 }
113 if c > 0x7E { c = 0x3F }
114 clean[i] = c
115 i = i + 1
116 }
117 sys_write(fd, clean, n)
118 return 0
119}
120
121func main() -> i64 {
122 ihp("=== IGNORED-HOST REACH CENSUS: our stack vs the hosts incumbents deindex ===\n")
123 let child: *u8 = "/tmp/_dlr_fetch_one.sov.elf\x00"
124 let probe: i64 = sys_openat_rd(child)
125 if probe < 0 { ihp(" prereq missing: build _dlr_fetch_one first\n"); sys_exit(3); return 3 }
126 sys_close(probe)
127 let envp: *i64 = sys_mmap(8 * 2) as *i64
128 envp[0] = "PATH=/usr/bin:/bin" as *u8 as i64; envp[1] = 0
129 let devnull: i64 = sys_openat_wr("/dev/null" as *u8, 0x1a4)
130
131 let lfd: i64 = sys_openat_append("knowledge/status/search_ignored_hosts.log" as *u8, 0x1a4)
132 if lfd < 0 { ihp(" log open failed\n"); sys_exit(1); return 1 }
133 ihf(lfd, "IHR-RUN epoch=" as *u8); ihfn(lfd, sys_now_realtime_sec()); ihf(lfd, "\n" as *u8)
134
135 var nok: i64 = 0
136 var nwall: i64 = 0
137 var nhang: i64 = 0
138 var nfail: i64 = 0
139 var e: i64 = 0
140 while e < NX_IH_HOSTS {
141 let url: *u8 = ih_url(e)
142 let outp: *u8 = ih_out(e)
143 let av: *i64 = sys_mmap(8 * 4) as *i64
144 av[0] = child as i64; av[1] = url as i64; av[2] = outp as i64; av[3] = 0
145 let t0: i64 = sys_now_ms()
146 let rc: i64 = nx_guarded_run(child, av, envp, NX_IH_DEADLINE, devnull, devnull)
147 let dt: i64 = sys_now_ms() - t0
148 ihp(" "); ihp(url); ihp(" ["); ihp(ih_class(e)); ihp("] -> ")
149 ihf(lfd, "IHR-HOST url=" as *u8); ihf(lfd, url)
150 ihf(lfd, " class=" as *u8); ihf(lfd, ih_class(e))
151 ihf(lfd, " rc=" as *u8); ihfn(lfd, rc)
152 ihf(lfd, " ms=" as *u8); ihfn(lfd, dt)
153 if rc == 0 {
154 let text: *u8 = sys_mmap(NX_MAGIC_524288)
155 let tl: i64 = ih_read_all(outp, text, NX_MAGIC_524288)
156 nok = nok + 1
157 ihp("REACHED "); ihn(tl); ihp(" text chars ("); ihn(dt); ihp("ms)\n")
158 ihf(lfd, " status=REACHED chars=" as *u8); ihfn(lfd, tl)
159 ihf(lfd, " excerpt=\"" as *u8); ih_excerpt(lfd, text, tl); ihf(lfd, "\"\n" as *u8)
160 } else {
161 if rc == 124 {
162 nhang = nhang + 1
163 ihp("TIMEOUT-REAPED at "); ihn(NX_IH_DEADLINE); ihp("ms (named, not faked)\n")
164 ihf(lfd, " status=TIMEOUT-REAPED\n" as *u8)
165 } else {
166 if rc == 2 {
167 nwall = nwall + 1
168 ihp("FETCH-REFUSED rc=2 (TLS/HTTP wall -- named, not faked)\n")
169 ihf(lfd, " status=WALLED\n" as *u8)
170 } else {
171 nfail = nfail + 1
172 ihp("fail rc="); ihn(rc); ihp("\n")
173 ihf(lfd, " status=FAIL\n" as *u8)
174 }
175 }
176 }
177 e = e + 1
178 }
179
180 ihp(" census: "); ihn(nok); ihp(" reached, "); ihn(nwall); ihp(" walled, ")
181 ihn(nhang); ihp(" hangs reaped, "); ihn(nfail); ihp(" fail of "); ihn(NX_IH_HOSTS); ihp("\n")
182 var green: i64 = 0
183 if nok >= NX_IH_GATE_MIN { green = 1 }
184 ihf(lfd, "IHR-GATE reached=" as *u8); ihfn(lfd, nok)
185 ihf(lfd, "/" as *u8); ihfn(lfd, NX_IH_HOSTS)
186 ihf(lfd, " walled=" as *u8); ihfn(lfd, nwall)
187 ihf(lfd, " hangs=" as *u8); ihfn(lfd, nhang)
188 ihf(lfd, " fail=" as *u8); ihfn(lfd, nfail)
189 ihf(lfd, " bar=" as *u8); ihfn(lfd, NX_IH_GATE_MIN)
190 if green == 1 { ihf(lfd, " verdict=GREEN\n" as *u8) } else { ihf(lfd, " verdict=RED\n" as *u8) }
191 sys_close(lfd)
192 if green == 1 {
193 ihp(" IHR-GATE: GREEN (the ignored-host class is reachable by our pipeline)\n")
194 sys_exit(0)
195 return 0
196 }
197 ihp(" IHR-GATE: RED\n")
198 sys_exit(1)
199 return 1
200}