Fast Reverse Proxy (frp)

The Problem

Exposing a local server behind NAT or firewall to the internet is a common challenge in distributed systems. Traditional solutions like port forwarding or VPNs are often cumbersome, inflexible, or require changes to the network infrastructure. This is particularly problematic for temporary or dynamic services.

What This Does

frp is a fast reverse proxy that simplifies exposing local services to the internet. It achieves this by running a lightweight frp server in the public internet and a frp client on the local machine behind NAT/firewall. The client connects to the server and tunnels traffic back to the local service.

The project is forked from fatedier/frp, which has a significant user base and community support. The core functionality is implemented in Go (pkg/ directory) and supports multiple protocols including TCP, UDP, HTTP, and HTTPS. The web dashboard (web/ directory) provides a user interface for monitoring and managing proxies.

How It Is Wired

Execution starts from the main.go files in cmd/frpc/ and cmd/frps/ for client and server respectively. The client and server communicate over a control connection established in pkg/msg/conn.go. The pkg/config/ directory handles configuration parsing and validation, supporting both legacy INI and modern YAML/TOML formats.

Proxy management is handled by client/proxy/proxy_manager.go and client/visitor/visitor_manager.go on the client side, while the server side uses pkg/nathole/controller.go for tunnel management. The dashboard (web/frpc/) provides a Vue.js frontend interacting with the Go backend via REST APIs defined in client/http/controller.go.

How To Use It

  1. Install: Clone the repository and build using make build. Alternatively, use the provided Dockerfiles (dockerfiles/Dockerfile-for-frpc and dockerfiles/Dockerfile-for-frps).
  1. Configure: - Edit conf/frps.toml for server configuration. - Edit conf/frpc.toml for client configuration.
  1. Run: ```bash # Start server ./frps -c conf/frps.toml

# Start client ./frpc -c conf/frpc.toml


### Real-World Use
A practical use case is exposing a local web application to the internet. For example, running a local Node.js app on port `3000` behind a NAT can be exposed via frp:

```ini
# frpc.toml
[common]
server_addr = your-public-ip
server_port = 7000

[proxy]
name = "web"
type = "http"
local_port = 3000
custom_domains = ["yourdomain.com"]

Code Health & Issues

  • High - No test coverage for pkg/plugin/ which contains critical proxy plugins. (148 test files found, but none in pkg/plugin/)
  • Med - pkg/config/legacy/ contains deprecated INI config support which may introduce complexity.
  • Low - Documentation in doc/ is sparse for advanced use cases.

The Bottom Line

frp is a mature, well-structured solution for exposing local services to the internet. It's particularly useful for temporary or dynamic services. The codebase is clean and modular, but the test coverage could be improved for plugin functionality. If you need a reliable reverse proxy with minimal setup, frp is a solid choice.