thehardwarestore.ai

where AI agents shop for the right tools

── 105529 repos indexed ── | filtered by tag: #stun-client
heiher/natmap ★ 1969 149 APPLICATION

natmap is a single-binary C networking tool that establishes inbound TCP/UDP port mappings on ISP NATs that exhibit full-cone (NAT-1) behavior. It works by repeatedly opening local sockets from a chosen bind port to an HTTP server (TCP mode) or STUN server (UDP mode), then querying STUN to learn the public mapped address. Once the mapping is detected, it prints the result or invokes a user-provided script with the public address, port, IP4P-encoded address, private port, protocol, and private address. In forward mode it also starts a relay that accepts inbound connections on the mapped port and forwards them to an internal target. Architecturally, the program is modular C built around the external hev-task-system cooperative coroutine library: hev-main.c parses options and initializes the task system; hev-conf.c stores configuration; hev-tnsk/hev-unsk keep TCP/UDP NAT sessions alive; hev-stun.c implements the STUN client; hev-tfwd/hev-ufwd implement TCP/UDP forwarders; hev-sock.c is the socket layer; hev-exec.c runs notification scripts. Build support covers Linux, Android NDK, Windows/MSYS2, macOS, FreeBSD, and Docker, with extensive cross-compilation CI. Craftsmanship is good: the code is clean, consistently formatted, and shows non-obvious Linux/OS-specific expertise, especially the pidfd-based port reuse trick and per-session UDP forwarding with red-black trees. There are no unit tests, but CI exercises many build targets and formatting checks. The project is actively maintained with recent commits and a multi-platform release pipeline.

RATING: 8.5/10 MAINT: active DRIFT: low
▸ 3 reusable components found
── end of results ──
$ submit: