nx_stun_client.nx
buildroot/runtime/nx_stun_client.nx
about
nx_stun_client.nx -- SOVEREIGN STUN client (server-reflexive address discovery), NishiLang, composing
nx_stun. The gather side of ICE: send a Binding Request to a STUN server, read the Binding Response, and
extract the XOR-MAPPED-ADDRESS -- your PUBLIC reflexive IP:port as the server saw it. Works against ANY
standard STUN server (ours OR a third-party one), proving byte-level interop, with ZERO third-party code.
sc_query(...) is the reusable primitive (real UDP socket round-trip, bounded by a timeout so it never
hangs). main() is a CLI that prints the reflexive address as JSON -- registered as the MCP tool
`nx_stun_probe` so an agent/operator can discover a public address over the wire.
license_tier: INDEPENDENT_REDERIVE genealogy_id: international-research-sources/ietf/rfc_5389
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_stun.nx
imported by: nx_stun_client_gate.nx
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 12 | const K_MAGIC_2048: i64 = 2048 |
functions
| 16 | func sc_find_xma(resp: *u8, n: i64) -> i64 |
| 31 | func sc_sockaddr(sa: *u8, i0: i64, i1: i64, i2: i64, i3: i64, port: i64) -> i64 called by 1: sc_query |
| 41 | func sc_query(i0: i64, i1: i64, i2: i64, i3: i64, port: i64, out_ip: *i64, out_port: *i64) -> i64 called by 2: mainmain calls 13: sys_mmapsc_sockaddrsys_socketsys_set_socket_timeoutsys_now_realtime_msst_write_header+7 |
| 69 | func cp(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 70 | func cpn(v: i64) -> i64 |
| 76 | func cp_parse_ip(s: *u8, oct: *i64) -> i64 |
| 104 | func cp_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64 & 0xff; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v } called by 1: main |
| 106 | func main(argc: i64, argv: *i64) -> i64 |