nx_udp_tracker.nx
buildroot/runtime/nx_udp_tracker.nx
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
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
| 17 | const NX_UDP_PROTO_ID: i64 = 0x41727101980 // BEP-15 connect magic |
| 18 | const NX_UDP_ACT_CONNECT: i64 = 0 |
| 19 | const NX_UDP_ACT_ANNOUNCE: i64 = 1 |
| 20 | const NX_UDP_ACT_SCRAPE: i64 = 2 |
| 21 | const NX_UDP_ACT_ERROR: i64 = 3 |
functions
| 23 | func _ut_put_u64(out: *u8, off: i64, v: i64) -> i64 |
| 30 | func _ut_get_u64(buf: *u8, off: i64) -> i64 |
| 33 | func _ut_put_u32(out: *u8, off: i64, v: i64) -> i64 |
| 37 | func _ut_get_u32(buf: *u8, off: i64) -> i64 |
| 40 | func _ut_put_u16(out: *u8, off: i64, v: i64) -> i64 { out[off]=(v>>8)&0xff; out[off+1]=v&0xff; return 0 } called by 1: nx_udp_build_announce |
| 43 | func nx_udp_build_connect(txid: i64, out: *u8) -> i64 |
| 51 | func nx_udp_parse_connect_resp(buf: *u8, n: i64, txid: i64, out_conn: *i64) -> i64 |
| 60 | func nx_udp_build_announce(conn_id: i64, txid: i64, info_hash: *u8, peer_id: *u8, |
| 83 | func nx_udp_parse_announce_resp(buf: *u8, n: i64, txid: i64, |