code wiki / (root) / nx_archive_probe.nx

nx_archive_probe.nx source

↩ module page · 37 lines · 2455 B

1// nx_archive_probe.nx -- R4 step 1: a SOVEREIGN, read-only live probe that resolves the time-machine's live-source 2// dependency. Fetches (1) the Wayback CDX API for the operator's example site page3.com -- which returns real 3// historical capture rows "urlkey timestamp original mimetype status digest length" = EXACTLY the temporal-index 4// data -- (2) the same for megastar.co.uk, and (3) data.commoncrawl.org for reachability + TLS-version. All over our 5// own TLS-1.3 client (nx_https_fetch_follow). If a host is TLS-1.2-max, our 1.3-only client fails the handshake -> 6// honest status=0, which blocks on the in-flight nx_tls12 work. No writes, no state change. license_tier: ORIGINAL 7import "nx_research_engine.nx" 8const K_MAGIC_4194304: i64 = 4194304 9const K_MAGIC_1400: i64 = 1400 10 11func phead(out: *u8, n: i64, lim: i64) -> i64 { var m: i64 = n; if m < 0 { m = 0 } if m > lim { m = lim } if m > 0 { sys_write(1, out, m) } sys_write(1, "\n" as *u8, 1); return 0 } 12 13func main() -> i64 { 14 let store: *TrustStore = rf_init() 15 if (store as i64) == 0 { rf_puts("probe: trust store load failed\n" as *u8); return 1 } 16 let cap: i64 = K_MAGIC_4194304 17 let out: *u8 = sys_mmap(cap) 18 let st: *i64 = sys_mmap(8) as *i64 19 20 rf_puts("== PROBE 1 Wayback CDX -> page3.com (real historical captures = temporal-index rows) ==\n" as *u8) 21 let n1: i64 = nx_https_fetch_follow("https://web.archive.org/cdx/search/cdx?url=page3.com&limit=12" as *u8, store, out, cap, 6, st) 22 rf_puts(" status="); rf_putn(st[0]); rf_puts(" bytes="); rf_putn(n1); rf_puts("\n --- head ---\n" as *u8) 23 phead(out, n1, K_MAGIC_1400) 24 25 rf_puts("\n== PROBE 2 Wayback CDX -> megastar.co.uk ==\n" as *u8) 26 let n2: i64 = nx_https_fetch_follow("https://web.archive.org/cdx/search/cdx?url=megastar.co.uk&limit=12" as *u8, store, out, cap, 6, st) 27 rf_puts(" status="); rf_putn(st[0]); rf_puts(" bytes="); rf_putn(n2); rf_puts("\n --- head ---\n" as *u8) 28 phead(out, n2, K_MAGIC_1400) 29 30 rf_puts("\n== PROBE 3 Common Crawl reachability -> data.commoncrawl.org ==\n" as *u8) 31 let n3: i64 = nx_https_fetch_follow("https://data.commoncrawl.org/" as *u8, store, out, cap, 6, st) 32 rf_puts(" status="); rf_putn(st[0]); rf_puts(" bytes="); rf_putn(n3); rf_puts("\n" as *u8) 33 phead(out, n3, 400) 34 35 rf_puts("\nPROBE DONE (sovereign TLS-1.3; status>0 = reachable, status=0/fail = TLS/handshake block -> needs nx_tls12)\n" as *u8) 36 return 0 37}