code wiki / (root) / nx_stun_server_gate.nx

nx_stun_server_gate.nx

buildroot/runtime/nx_stun_server_gate.nx

6937 B131 linesdepth 6pulls 6 transitivereach 0 importersview sourcekind gate/prooftopic stun
docsdependenciesstructsconstsfunctions

about

nx_stun_server_gate.nx -- proves the sovereign STUN reflexive responder two ways: PART A (pure): ss_handle reflects a request's source sockaddr into a valid Binding Response whose XOR-MAPPED-ADDRESS decodes back to that source IP:port, with the txid preserved and a self-consistent FINGERPRINT; a non-STUN packet is ignored (returns 0). PART B (LIVE, real UDP sockets): a fork loopback -- child = the server, parent = a client bound to a KNOWN port -- proves end-to-end that a client sending a real Binding Request LEARNS ITS OWN REFLEXIVE ADDRESS (127.0.0.1:<client port>) back from the server. This is srflx discovery working, sovereignly. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_stun_server.nx nx_stun_server_gate.nx

imports: nx_syscalls.nxnx_stun_server.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 st_write_header st_put16 st_put32 ss_sockaddr ss_handle st_type st_get16 st_magic st_get32 ss_build_response st_write_header ↻ st_put16 ↻ st_xma_encode st_put16 ↻ st_put32 ↻ st_fingerprint nx_crc32 st_put32 ↻ ss_src_port ss_src_addr st_type ↻ st_magic ↻ gck gw ↻ st_xma_port st_get16 ↻ st_xma_addr st_get32 ↻ gn sys_mmap ↻ sys_write ↻ st_fingerprint ↻ st_get32 ↻ sys_socket sys_set_socket_timeout sys_mmap ↻

structs

none

consts

23const SGT_SPORT: i64 = 53218 // server loopback port for the live proof
24const SGT_CPORT: i64 = 53219 // client loopback port (its known source port)

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
26func main() -> i64