This document provides an introduction to frp (Fast Reverse Proxy), a high-performance reverse proxy system designed to expose services behind NAT or firewalls to the public internet. This overview covers the fundamental architecture, core components, supported proxy types, and key capabilities of the system.
For detailed information on specific subsystems, see:
Sources: README.md45-47 README_zh.md10
frp is a client-server application that enables secure, efficient tunneling of network traffic from services located behind NAT or firewalls to the public internet. The system consists of two primary binaries:
The system supports multiple protocols (TCP, UDP, HTTP, HTTPS) and provides advanced features including load balancing, P2P direct connections, multiplexing, and comprehensive monitoring. The current stable version is 0.69.1.
Sources: README.md45-47 README_zh.md10 pkg/util/version/version.go17
The frp system follows a client-server architecture where frps (server) and frpc (client) communicate through a control connection and exchange data through work connections.
Sources: cmd/frps/main.go23-26 cmd/frpc/main.go23-26 README.md57
Sources: server/control.go1-50 client/service.go1-50 client/control.go1-50 pkg/msg/msg.go1-100
The frps binary is the server-side component. Entry point at cmd/frps/main.go23-26 invokes rootCmd.Execute() from the cobra CLI framework.
Core Components:
| Component | Responsibility |
|---|---|
server.Service | Main service lifecycle manager. |
control.Manager | Manages multiple client control connections. |
control.Control | Per-client connection handler and message dispatcher. |
control.ResourceController | Port, domain, and virtual host resource allocation. |
proxy.Manager | Manages server-side proxy instances and routing. |
Sources: cmd/frps/main.go23-26 server/control.go61-70 server/proxy/proxy.go34-40
The frpc binary runs behind NAT/firewalls. Entry point at cmd/frpc/main.go23-26 invokes rootCmd.Execute().
Core Components:
| Component | Responsibility |
|---|---|
client.Service | Main client service lifecycle and configuration management. |
Connector interface | Transport protocol abstraction (TCP/KCP/QUIC/WebSocket). |
client.Control | Maintains the control connection to frps and handles heartbeats. |
proxy.Manager | Manages client-side proxy instances and local service connections. |
visitor.Visitor | Manages client-to-client connections for STCP/XTCP. |
Sources: cmd/frpc/main.go23-26 client/service.go42-55 client/control.go65-75 client/connector.go32-37
frp supports several proxy modes to accommodate different network requirements:
| Type | Description | Key Features |
|---|---|---|
| TCP | Standard TCP port forwarding | Direct port mapping |
| UDP | Standard UDP port forwarding | DNS, game server support |
| HTTP/HTTPS | Layer 7 virtual hosting | Domain and URL routing |
| STCP | Secret TCP | Encrypted via shared secret, requires visitor |
| XTCP | P2P TCP | NAT hole punching for direct data transfer |
| SUDP | Secret UDP | Secure UDP via shared secret |
| TCPMux | TCP Multiplexing | Multiple services sharing one port via domain |
Sources: README.md47-49 README.md58-68
frp supports multiple underlying transport protocols for the tunnel between frpc and frps:
Sources: README.md89-91 README_zh.md51 Release.md8
frp utilizes TCP stream multiplexing to send multiple logical connections over a single physical connection, reducing handshake overhead and latency. It also supports connection pooling to maintain a set of ready-to-use connections.
Sources: README.md88-91 README_zh.md52
Sources: README.md77-81 README_zh.md57
Sources: README.md72-76 README_zh.md58
frp is widely used in production and testing environments. The project is currently iterating on the v0.x series (aiming for v1 stability). A v2 version is under conceptual development, intended to introduce a modernized, highly scalable proxy core inspired by cloud-native technologies like Envoy and Kubernetes.
Sources: README.md121-135 README_zh.md60-75 pkg/util/version/version.go17
Refresh this wiki