code wiki / (root) / nx_http_tracker.nx

nx_http_tracker.nx

buildroot/runtime/nx_http_tracker.nx

7907 B141 linesdepth 6pulls 12 transitivereach 6 importersview sourcekind tooltopic http
docsdependenciesstructsconstsfunctions

about

nx_http_tracker.nx -- SOVEREIGN HTTP/TCP BitTorrent tracker announce (X-TORRENT-LIVE-002 R1). WHY: this network blocks UDP to the usual tracker ports (:1337/:6969); HTTP trackers ride TCP :80/:443 (which works -- the browser proves it), so they bypass the UDP block AND give the team a second, independent peer-discovery channel. Pure-organ: composes nx_http_client (GET over TCP) + nx_bencode (decode the response) + nx_dns_a (resolve the tracker host). NO curl, NO libtorrent. The team decides which trackers to use + how to merge peers -- nothing external decides. announce GET: <path>?info_hash=%XX*20&peer_id=%XX*20&port=6881&uploaded=0&downloaded=0&compact=1 &left=<n>&event=started -> bencoded {interval, peers:<compact 6B/peer>} (or failure) license_tier: ORIGINAL layer: peer-discovery (feeds the worker's peer set, like cl_announce/UDP) module: nishi-core.torrent.http_tracker depends: nishi-core.http_client, nishi-core.bencode, nishi-core.dns_a

dependencies 4 imports · 1 importers

nx_http_client.nx nx_bencode.nx nx_dns_a.nx nx_tracker_url.nx nx_http_tracker.nx nx_torrent_get.nx

imports: nx_http_client.nxnx_bencode.nxnx_dns_a.nxnx_tracker_url.nx

imported by: nx_torrent_get.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ht_urlenc20 ht_report ht_p2 ht_strlen ht_puts ht_parse_peers nx_bc_dict_get sys_mmap nx_bc_str _bc_is_digit _bc_bytes_eq nx_bc_skip _bc_is_digit ↻ nx_bc_str ↻ ht_p2 ↻ ht_pn2 ht_putn

structs

none

consts

17const K_MAGIC_2048: i64 = 2048
18const K_MAGIC_131072: i64 = 131072
19const K_MAGIC_6881: i64 = 6881
20const K_MAGIC_16909060: i64 = 16909060

functions

22func ht_strlen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 2: ht_p2ht_announce
23func ht_puts(dst: *u8, off: i64, s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { dst[off+i] = s[i]; i = i + 1 } return off + i }
called by 2: ht_announcemain
24func ht_putn(dst: *u8, off: i64, v: i64) -> i64
called by 2: ht_pn2ht_announce
32func ht_p2(s: *u8) -> i64 { sys_write(1, s, ht_strlen(s)); return 0 }
called by 2: ht_reportmain calls 1: ht_strlen
33func ht_pn2(v: i64) -> i64 { let b: *u8 = sys_mmap(28); let e: i64 = ht_putn(b, 0, v); sys_write(1, b, e); return 0 }
called by 1: main calls 1: ht_putn
34func ht_report(label: *u8, ok: i64) -> i64 { if ok == 1 { ht_p2(" [PASS] " as *u8) } else { ht_p2(" [FAIL] " as *u8) } ht_p2(label); ht_p2("\n" as *u8); return 0 }
called by 1: main calls 1: ht_p2
37func ht_urlenc20(raw: *u8, out: *u8) -> i64
called by 2: ht_announcemain
51func ht_find_body(buf: *u8, n: i64) -> i64
called by 1: ht_announce
62func ht_parse_peers(buf: *u8, boff: i64, n: i64, ips: *i64, ports: *i64, max: i64) -> i64
83func ht_announce(host: *u8, ip4: *u8, port: i64, path: *u8, info_hash: *u8, peer_id: *u8, left: i64, ips: *i64, ports: *i64, max: i64) -> i64
100func ht_announce_url(url: *u8, info_hash: *u8, peer_id: *u8, left: i64, ips: *i64, ports: *i64, max: i64) -> i64
111func main() -> i64