$ account heiher
HevSocks5Tunnel is a lightweight, high-performance tun2socks proxy written in C. It creates a virtual TUN interface and forwards all TCP/UDP traffic through a SOCKS5 proxy, supporting IPv4/IPv6 dual-stack, UDP-in-UDP and UDP-in-TCP relay modes, optional local ICMP echo replies, and a mapped DNS feature for transparent DNS resolution. The architecture is monolithic but modular: a YAML-based configuration parser, platform-specific tunnel backends (Linux, FreeBSD, macOS, NetBSD, Windows via Wintun), and a session management layer built on top of lwIP and the hev-task-system cooperative multitasking library. It can be used as a standalone CLI tool, a static/shared library, or embedded via JNI on Android. The codebase demonstrates strong C craftsmanship with clean abstractions, efficient I/O patterns (ring buffer with iovec, scatter/gather), and careful platform abstraction.
NATMap is a command-line tool written in C that establishes TCP/UDP port mappings from an ISP NAT public address to a local private address. It uses STUN protocol to discover the mapped public address and maintain NAT bindings through keep-alive sessions. The architecture is built on a cooperative task-based concurrency model (hev-task-system) for efficient non-blocking I/O. It supports two modes: bind mode, where the tool keeps the port alive and notifies the user via a script, and forward mode, where it listens on the mapped port and forwards traffic to an internal target. The codebase is modular, with clear separation of concerns: configuration parsing, socket creation, STUN protocol handling, NAT session keepers (TCP/UDP), port forwarding servers, and script execution. It is highly portable, with cross-compilation support for Linux, Windows, macOS, FreeBSD, and Android across many architectures.