code wiki / _hdl_build / nx_galx_bridge.nx

nx_galx_bridge.nx

buildroot/runtime/_hdl_build/nx_galx_bridge.nx

6120 B123 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind tooltopic galx
docsdependenciesstructsconstsfunctions

about

nx_galx_bridge.nx -- SOVEREIGN reverse-tunnel bridging the WSL-workstation gallery to the always-on NAS. The gallery runs on the workstation (WSL2-NAT'd -> NOT LAN-reachable). Instead of netsh/ssh, the workstation DIALS OUT to the NAS (outbound traverses the NAT); the NAS routes nishifamily.com/gallery requests back down those pooled connections to the workstation, which forwards them to the local OPAQUE gateway -> gallery. Pure sockets (sys_socket/connect/bind/listen/accept/read/write/fork) -- NO sh, NO netsh, NO ssh. NAS mode: nx_galx_bridge nas <tunnel_port> <front_port> listen tunnel_port (workstation dials IN -> conns wait in the accept backlog = the pool) + front_port (the NAS TLS front sends /gallery requests here, loopback). Per front request: fork -> accept one pooled worker -> forward request -> relay worker->front until close. WS mode: nx_galx_bridge ws <a> <b> <c> <d> <tunnel_port> <gateway_port> <pool> fork <pool> dialers; each loops: connect <a.b.c.d>:tunnel_port -> read the routed request -> connect 127.0.0.1:gateway_port (the OPAQUE gateway) -> forward -> relay gateway->tunnel until close -> reconnect.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_connect.nx nx_galx_bridge.nx

imports: nx_syscalls.nxnx_connect.nx

imported by: nobody (leaf or entry point)

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

main sys_write sys_exit gb_atoi gb_listen sys_mmap sys_socket sys_setsockopt sys_bind sys_close sys_listen sys_mmap ↻ sys_wait4 sys_accept sys_fork sys_close ↻ sys_set_socket_timeout sys_mmap ↻ sys_setsockopt ↻ sys_munmap sys_read gb_relay sys_mmap ↻ sys_read ↻ sys_write ↻ gb_connect sys_socket ↻ sys_mmap ↻ nx_connect_bounded nx_fcntl sys_connect sys_mmap ↻ sys_poll sys_close ↻ sys_sleep_ms sys_mmap ↻ sys_munmap ↻

structs

none

consts

15const K_MAGIC_65536: i64 = 65536
16const K_MAGIC_1000000000: i64 = 1000000000
17const K_MAGIC_131072: i64 = 131072
18const K_MAGIC_3600: i64 = 3600

functions

20func gb_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; if c<48{return v} if c>57{return v} v=v*10+(c-48); i=i+1 } return v }
called by 1: main
23func gb_connect(a: i64, b: i64, c: i64, d: i64, port: i64) -> i64
33func gb_listen(port: i64) -> i64
46func gb_relay(src: i64, dst: i64) -> i64
called by 1: main calls 3: sys_mmapsys_readsys_write
52func main(argc: i64, argv: *i64) -> i64