code wiki / (root) / nx_router_ctl.nx

nx_router_ctl.nx

buildroot/runtime/nx_router_ctl.nx

9869 B99 linesdepth 10pulls 22 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_router_ctl.nx -- SOVEREIGN router control (operator: "you have api access, get it going, towards apis"; roadmap NR-7). Drives the home GL.iNet GL-BE9300 (OpenWrt) via its uci config API over OUR OWN sovereign SSH (nx_ssh_lib -- curve25519 KEX, chacha/aes, exec channel), NOT WSL bash. Verbs: fwadd [port] [destip] -> idempotent DNAT redirect wan:port -> destip:port (TCP+UDP); opens the seeder to WAN fwlist -> show our Nishi firewall redirects wan -> WAN interface IP (are we actually reachable?) Password from data/router.pw (0600; vault-migratable). Router LAN IP 192.168.8.1. license_tier: ORIGINAL

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_ssh_lib.nx nx_router_ctl.nx

imports: nx_syscalls.nxnx_ssh_lib.nx

imported by: nobody (leaf or entry point)

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

main ssh_puts sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close sys_exit ssh_open_session sys_socket sys_mmap ↻ ssh_sockaddr nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll ssh_kex sys_write ↻ sys_mmap ↻ ssh_read_line sys_read ↻ ssh_read_packet sys_mmap ↻ ssh_read_full sys_read ↻ ssh_u32be ssh_put_bytes ssh_put_byte ssh_put_bytes ↻ ssh_put_str ssh_put_u32 ssh_put_bytes ↻ ssh_put_u32 ↻ ssh_send_packet sys_mmap ↻ ssh_put_u32 ↻

structs

none

consts

10const RC_MAGIC_6881: i64 = 6881
11const RC_MAGIC_8192: i64 = 8192
13const RC_PW: *u8 = "data/router.pw" as *u8
14const RC_ROUTER: i64 = (192 << 24) | (168 << 16) | (8 << 8) | 1 // 192.168.8.1 (GL.iNet LAN)

functions

16func rc_slen(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return n }
17func rc_app(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8) { dst[o]=s[i]; o=o+1; i=i+1 } return o }
called by 2: rc_redirmain
18func rc_appn(dst: *u8, o: i64, v: i64) -> i64 { if v==0 { dst[o]=48 as u8; return o+1 } var m: i64=v; let t: *u8=sys_mmap(28); var k: i64=0; while m>0 { t[k]=(48+(m%10)) as u8; m=m/10; k=k+1 } while k>0 { k=k-1; dst[o]=t[k]; o=o+1 } return o }
called by 2: rc_redirmain calls 1: sys_mmap
19func rc_streq(a: *u8, b: *u8) -> i64 { var i: i64=0; while a[i]!=(0 as u8) { if a[i]!=b[i] { return 0 } i=i+1 } if b[i]!=(0 as u8) { return 0 } return 1 }
called by 1: main
22func rc_redir(buf: *u8, o: i64, sect: *u8, proto: *u8, port: i64, destip: *u8) -> i64
called by 1: main calls 2: rc_apprc_appn
36func main(argc: i64, argv: *i64) -> i64