TINY-FRPC is a lightweight, portable C implementation of the FRP client protocol, focused on STCP (Secret TCP) and designed for embedded / resource-constrained environments.
- π Minimal dependencies β pure C core, no external runtime required
- π¦ Portable β runs on embedded systems, Linux, and macOS
- π STCP support β Secret TCP with shared-key authentication
- π AES-128-CFB encryption β full encryption support after login
- π Multi-language bindings β Python, Node.js, Rust, Go (CGO)
- β Protocol alignment β validated against upstream Go implementations
Note: This implementation uses Direct TCP mode only (
tcp_mux=false). Yamux multiplexing is not supported.
tiny-frpc/
βββ include/ # Public C headers
βββ source/ # C implementation (frpc, crypto, tools)
βββ *.md # Protocol documentation
wrapper/linux/ # POSIX wrapper layer (portable I/O)
bindings/
βββ python/ # Python bindings (ctypes)
βββ nodejs/ # Node.js bindings (N-API)
βββ rust/ # Rust bindings (FFI)
cmd/ # CGO alignment tests (Go β C)
tests/ # Pure C unit tests
demo/stcp/ # STCP demo applications
third-party/
βββ frp/ # Upstream FRP (git submodule)
βββ yamux/ # Upstream Yamux (git submodule, FRP dependency only)
- C compiler: GCC or Clang
- Go: see
go.modfor version - Git: for submodules
# Clone and initialize submodules
git submodule update --init --recursive
# Install Go dependencies (recommended for China networks)
GOPROXY=https://goproxy.cn,direct make install
# Build all libraries
make all# Run all tests (C unit tests + CGO alignment tests)
make test
# Run language bindings tests
make test-bindings
# Run P3 (Three-Process) tests with real FRPS
make p3| Library | Description |
|---|---|
libtools.a |
Utilities (byte order, time, MD5) |
libcrypto.a |
AES-128-CFB encryption implementation |
libfrpc.a |
FRP client core + STCP |
libwrapper.a |
POSIX wrapper layer |
libfrpc-bindings.a |
Simplified API for language bindings |
libfrpc-bindings.so |
Shared library for bindings |
| Target | Description |
|---|---|
make all |
Build all C static libraries |
make test |
Run C unit tests + CGO alignment tests |
make test-bindings |
Run Python + Node.js + Rust binding tests |
make p3 |
Run P3 tests (Real FRPS + Multiple Visitors) |
make frpc-test |
Run FRP/STCP CGO tests |
make edge-case-test |
Run C edge case tests |
make demo |
Build and run STCP demo |
make coverage |
Generate code coverage report |
make clean |
Remove build outputs |
from frpc_python import FRPCClient, TunnelType
client = FRPCClient("127.0.0.1", 7000, "token")
tunnel = client.create_tunnel(
TunnelType.STCP_SERVER,
"my_tunnel",
secret_key="secret",
local_addr="127.0.0.1",
local_port=8080
)
client.connect()
tunnel.start()const { FRPCClient, TunnelType } = require('./frpc_node');
const client = new FRPCClient('127.0.0.1', 7000, 'token');
const tunnel = client.createTunnel(TunnelType.STCP_VISITOR, 'my_tunnel', {
secretKey: 'secret',
remoteName: 'server_tunnel',
bindAddr: '127.0.0.1',
bindPort: 9090
});
client.connect();use frpc_rs::{FrpcClient, TunnelConfig, TunnelType};
let mut client = FrpcClient::new("127.0.0.1", 7000, Some("token"))?;
let config = TunnelConfig {
tunnel_type: TunnelType::StcpServer,
tunnel_name: "my_tunnel".to_string(),
secret_key: Some("secret".to_string()),
local_addr: Some("127.0.0.1".to_string()),
local_port: Some(8080),
..Default::default()
};
let tunnel = client.create_tunnel(config, None)?;
client.connect()?;
tunnel.start()?;make test V=1 # Verbose Go build/test logs
TINY_FRPC_VERBOSE=1 make test # Enable C-side diagnostics- Hybrid C/Go: C implements portable core, Go (CGO) provides alignment tests against upstream
- Upstream pinning:
go.modusesreplace => ./third-party/*to avoid drift - Coverage builds: Separated into
build-cov/to avoid contaminating normal builds
| Stage | Description | Status |
|---|---|---|
| 1 | FRP STCP (Visitor + Server) | β Complete |
| 2 | POSIX wrapper layer | β Complete |
| 3 | AES-128-CFB Encryption | β Complete |
| 4 | Multi-language bindings | β Complete |
Note: TCPMux (Yamux multiplexing) is not supported. This implementation only supports Direct TCP mode (
tcp_mux=false).
tiny-frpc/FRP-STCP.mdβ STCP protocol notestiny-frpc/LOGIC.mdβ Architecture logic and flowtiny-frpc/DESIGN.mdβ Design documentbindings/README.mdβ Language bindings guide
MIT License. See LICENSE for details.