code wiki / (root) / nx_stun_client_gate.nx

nx_stun_client_gate.nx

buildroot/runtime/nx_stun_client_gate.nx

6871 B133 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic stun
docsdependenciesstructsconstsfunctions

about

nx_stun_client_gate.nx -- proves the sovereign STUN client two ways: PART A (pure): sc_find_xma walks a real STUN response (RFC 5769 2.2, where XOR-MAPPED-ADDRESS is NOT the first attribute) and locates it, decoding 192.0.2.1:32853; a response with no XMA returns -1; the dotted-quad parser accepts valid IPs and rejects malformed ones. PART B (LIVE, real UDP): a fork loopback -- child = an inline reflexive responder, parent = sc_query -- proves sc_query performs a real Binding request/response round-trip and RECOVERS a reflexive address. The server side is inlined from nx_stun primitives (not imported) to avoid a diamond import of nx_stun. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_stun_client.nx nx_stun_client_gate.nx

imports: nx_syscalls.nxnx_stun_client.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap gw sys_write hexdec hxv sc_find_xma st_len st_get16 st_get16 ↻ st_xma_port st_get16 ↻ st_xma_addr st_get32 gck gw ↻ st_write_header st_put16 st_put32 cp_parse_ip sys_socket sys_set_socket_timeout sys_mmap ↻ sys_setsockopt sys_munmap sys_bind sys_fork sys_recvfrom g_respond st_write_header ↻ st_put16 ↻ st_xma_encode st_put16 ↻ st_put32 ↻ st_fingerprint nx_crc32 st_put32 ↻ sys_sendto sys_close sys_exit

structs

none

consts

43const CGT_SPORT: i64 = 53230

functions

12func gw(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 2: gckmain calls 1: sys_write
13func gn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
18func gck(pass: i64, name: *u8, fails: *i64) -> i64
called by 1: main calls 1: gw
22func hxv(c: i64) -> i64
called by 1: hexdec
28func hexdec(hex: *u8, nbytes: i64, out: *u8) -> i64 { var i: i64=0; while i<nbytes { out[i]=((hxv(hex[i*2] as i64)<<4) | hxv(hex[i*2+1] as i64)) as u8; i=i+1 } return 0 }
called by 1: main calls 1: hxv
31func g_respond(buf: *u8, txid: *u8, port: i64, addr: i64) -> i64
45func main() -> i64