code wiki / (root) / nx_torrent_leech_probe.nx

nx_torrent_leech_probe.nx

buildroot/runtime/nx_torrent_leech_probe.nx

12462 B204 linesdepth 8pulls 20 transitivereach 0 importersview sourcekind probetopic torrent
docsdependenciesstructsconstsfunctions

about

nx_torrent_leech_probe.nx -- pull a WHOLE file off a BitTorrent seeder + verify every piece. Two jobs, one organ: (GATE, no args) = the INTEGRATION proof: originate a torrent (nx_torrent_mkinfo) -> seed it (nx_torrent_seed.ts_serve_peer) -> leech the FULL file back -> verify EACH piece's SHA-1 against the info-dict's ADVERTISED hashes (what a real client checks) -> assert the reassembled file's info_hash == the original's. Proves originate->seed->leech->verify. (LIVE) <ip> <port> <ih_hex40> <plen> <total> <outfile> = connect a REAL remote seeder (e.g. the NAS), download the file, write it, and print the reassembled file's info_hash (compare to the seed's -> byte-perfect P2P transfer). license_tier: ORIGINAL module: nishi-core.torrent.leech_probe depends: nishi-core.torrent.seed, nishi-core.torrent.mkinfo, nishi-core.torrent.peerwire, nishi-core.crypto.sha1

dependencies 5 imports · 0 importers

nx_torrent_seed.nx nx_connect.nx nx_torrent_mkinfo.nx nx_peerwire.nx nx_sha1.nx nx_torrent_leech_probe.nx

imports: nx_torrent_seed.nxnx_connect.nxnx_torrent_mkinfo.nxnx_peerwire.nxnx_sha1.nx

imported by: nobody (leaf or entry point)

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

main lp_gate sys_openat_wr lp_w mk_build_info mk_read_n sys_read mk_slen mk_cat mk_bstr mk_catn mk_catbytes mk_bint mk_catn ↻ ts_sockaddr sys_socket sys_setsockopt sys_set_socket_timeout sys_mmap sys_setsockopt ↻ sys_munmap sys_bind sys_listen sys_fork sys_accept ts_serve_peer sys_set_socket_timeout ↻ ts_read_n sys_read ↻ mse_classify_first_byte nx_pw_parse_handshake ts_memeq mse_ctx_plain ts_serve_after_hs nx_pw_build_handshake mse_write rc4_crypt rc4_prga_byte mw_write_n ts_load_have

structs

none

consts

19const LP_MAGIC_65536: i64 = 65536
20const LP_MAGIC_4096: i64 = 4096
21const LP_MAGIC_53611: i64 = 53611
23const LP_BLK: i64 = 16384

functions

25func lp_w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 3: lp_livelp_gatemain
26func lp_wn(v: i64) -> i64
called by 2: lp_livelp_gate
36func lp_leech(ctx: *MseCtx, cfd: i64, ih: *u8, my_pid: *u8, plen: i64, total: i64, npc: i64, outbuf: *u8, expect_pieces: *u8, got_all: *i64) -> i64
97func lp_sockaddr_ip(sa: *u8, port: i64, ipstr: *u8) -> i64
called by 1: lp_live calls 1: ts_sockaddr
106func lp_live(ipstr: *u8, port: i64, ihhex: *u8, plen: i64, total: i64, outfile: *u8, mse: i64) -> i64
142func lp_gate() -> i64
190func main(argc: i64, argv: *i64) -> i64