code wiki / (root) / nx_pex_gate.nx

nx_pex_gate.nx

buildroot/runtime/nx_pex_gate.nx

8674 B159 linesdepth 5pulls 10 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_pex_gate.nx -- SOVEREIGN LOOPBACK gate for BEP-11 ut_pex: proves PEX rides the REAL BEP-10 extension channel over a real TCP socket (not just the deterministic parser, which nx_pex's baked KAT already covers). A mock peer does the BEP-3 handshake (ext bit) + BEP-10 ext handshake (advertising ut_pex) + sends a real ut_pex ext message carrying a compact peer list; the client dispatches on the ext-id WE advertised, learns the peer's ut_pex id, and pex_parse_added's the gossiped peers. This is the live-channel proof that, once connected to ONE peer, we harvest MORE. license_tier: ORIGINAL module: nishi-core.torrent.pex_gate depends: nishi-core.torrent.pex, nishi-core.torrent.peerwire

dependencies 4 imports · 0 importers

nx_pex.nx nx_connect.nx nx_peerwire.nx nx_gate_verdict.nx nx_pex_gate.nx

imports: nx_pex.nxnx_connect.nxnx_peerwire.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gx_sockaddr sys_socket sys_setsockopt sys_set_socket_timeout sys_mmap sys_setsockopt ↻ sys_munmap sys_bind sys_listen gx_w sys_fork sys_accept gx_read_n sys_read nx_pw_build_handshake gx_write_n gx_read_msg gx_read_n ↻ _pw_get_u32 px_build_ext nx_pw_build_msg _pw_put_u32 gx_len pex_build_added px_puts px_putdec nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll nx_pw_parse_handshake nx_pw_msg_id pex_peer_id nx_bc_dict_get sys_mmap ↻ nx_bc_str _bc_is_digit _bc_bytes_eq

structs

none

consts

16const PW_EXTENDED: i64 = 20

functions

18func gx_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 }
called by 1: main
19func gx_wn(fd: i64, v: i64) -> i64
called by 1: main
24func gx_len(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: main
25func gx_sockaddr(sa: *u8, port: i64, i0: i64, i1: i64, i2: i64, i3: i64) -> i64
called by 1: main
32func gx_read_n(fd: i64, buf: *u8, n: i64) -> i64
called by 2: gx_read_msgmain calls 1: sys_read
37func gx_write_n(fd: i64, buf: *u8, n: i64) -> i64
called by 1: main
42func gx_read_msg(fd: i64, mb: *u8, cap: i64) -> i64
called by 1: main calls 2: gx_read_n_pw_get_u32
52func px_build_ext(ext_id: i64, ben: *u8, benlen: i64, out: *u8) -> i64
called by 1: main calls 1: nx_pw_build_msg
59func main() -> i64