$ show editso/fuso
Fuso is a Rust-based intranet penetration and port forwarding tool that enables exposing local services behind NAT to the public internet via a relay server. It implements a client-server architecture with support for TCP forwarding, SOCKS5 proxy (including UDP association), KCP protocol for reliable UDP transport, LZ4 compression, and RSA+AES encryption. The system is built on a custom async runtime abstraction (supporting tokio and smol), with a modular design using provider and builder patterns. The server (fus) manages client connections and public listeners, while the client (fuc) registers port mappings and forwards traffic. Additional features include bridge mode for cascading proxies, heartbeat health checks, observer hooks for external notifications, and a configuration API. The codebase demonstrates strong Rust async patterns, protocol implementation skills, and a clean separation between core abstractions and runtime specifics.
The LLM identified 5 files worth highlighting for reuse:
Implements an async packet-based protocol with magic bytes, length prefix, and variable payload. Provides traits AsyncRecvPacket and AsyncSendPacket with non-blocking poll-based futures. The state machine handles header parsing, body receiving, and supports empty packets. This component is self-contained, depends only on AsyncRead/AsyncWrite traits, and can be extracted for any project needing a reliable length-delimited message protocol.
An LZ4 compression stream wrapper that implements AsyncRead and AsyncWrite with on-the-fly compression and decompression. Uses a C FFI to the LZ4 library, managing ring buffers for streaming and a buffer for overflow data. The Encoder/Decoder traits abstract the compression layer. This component is isolated and can be reused for compressing any async byte stream.
Implements AES-CBC encryption/decryption over an async stream, with Encrypt/Decrypt traits. Handles buffering for incomplete blocks and premature reads. The implementation uses the cbc crate with Pkcs7 padding and is self-contained, depending only on AsyncRead/AsyncWrite. It can be reused to add transparent AES encryption to any byte stream.
A full implementation of the KCP protocol (reliable UDP) with session management, connector, and listener. Supports multiple concurrent sessions over a single UDP socket, with automatic session cleanup and heartbeat. The KcpConnector and KcpListener provide a client/server abstraction, and KcpStream implements AsyncRead/AsyncWrite. This component is a reusable reliable UDP library that can be extracted for other networking projects.
Provides a generic forward function that copies data bidirectionally between two async read/write streams. Uses a split mechanism (ReadHalf/WriteHalf) implemented with Arc<Mutex<T>> for sharing ownership. The Forward future polls both copy futures concurrently. This is a clean, reusable utility for any proxy or forwarding application.