code wiki / (root) / nx_udp_tracker.nx

nx_udp_tracker.nx

buildroot/runtime/nx_udp_tracker.nx

4468 B105 linesdepth 2pulls 2 transitivereach 12 importersview sourcekind librarytopic udp
docsdependenciesstructsconstsfunctions

about

nx_udp_tracker.nx -- BitTorrent UDP tracker protocol (BEP-15), bits-up. module: nishi-core.torrent.udp_tracker depends: nx_syscalls.nx capability: CORE_COMPUTE wired_status: FULLY_WIRED The dominant tracker transport (BEP-15, Olaf van der Spek 2008): ~618 bytes / 4 packets for 50 peers vs HTTP's ~1206 / 10 -- half the bytes, no TCP setup. Two-step: connect (get a connection_id) then announce (get peers). Pure build/parse here (KAT'd, deterministic); the UDP socket round-trip reuses the net stack + nx_net_governor pacing. Big-endian wire; magic protocol_id 0x41727101980.

dependencies 1 imports · 4 importers

nx_syscalls.nx nx_udp_tracker.nx nx_peer_connect_live.nx nx_tracker_live.nx nx_udp_tracker_announce.nx nx_udp_tracker_test.nx

imports: nx_syscalls.nx

imported by: nx_peer_connect_live.nxnx_tracker_live.nxnx_udp_tracker_announce.nxnx_udp_tracker_test.nx

structs

none

consts

17const NX_UDP_PROTO_ID: i64 = 0x41727101980 // BEP-15 connect magic
18const NX_UDP_ACT_CONNECT: i64 = 0
19const NX_UDP_ACT_ANNOUNCE: i64 = 1
20const NX_UDP_ACT_SCRAPE: i64 = 2
21const NX_UDP_ACT_ERROR: i64 = 3

functions

23func _ut_put_u64(out: *u8, off: i64, v: i64) -> i64
30func _ut_get_u64(buf: *u8, off: i64) -> i64
33func _ut_put_u32(out: *u8, off: i64, v: i64) -> i64
37func _ut_get_u32(buf: *u8, off: i64) -> i64
40func _ut_put_u16(out: *u8, off: i64, v: i64) -> i64 { out[off]=(v>>8)&0xff; out[off+1]=v&0xff; return 0 }
43func nx_udp_build_connect(txid: i64, out: *u8) -> i64
51func nx_udp_parse_connect_resp(buf: *u8, n: i64, txid: i64, out_conn: *i64) -> i64
60func nx_udp_build_announce(conn_id: i64, txid: i64, info_hash: *u8, peer_id: *u8,
83func nx_udp_parse_announce_resp(buf: *u8, n: i64, txid: i64,