Mutable.ai logoAuto Wiki by Mutable.ai
Create your own wiki
AI-generated instantly
Updates automatically
Solo and team plans
Create your own wiki
AI-generated instantly
Updates automatically
Solo and team plans

frp

Auto-generated from fatedier/frp by Mutable.ai Auto WikiRevise

frp
GitHub Repository
Developerfatedier
Written inGo
Stars79k
Watchers1.6k
Created12/21/2015
Last updated04/04/2024
LicenseApache License 2.0
Repositoryfatedier/frp
Auto Wiki
Revision
Software Version0.0.8Basic
Generated fromCommit 590ccd
Generated at04/04/2024
• • •
Architecture Diagram for frp
Architecture Diagram for frp

The FRP (Fast Reverse Proxy) repository provides a tool for exposing a local server behind a NAT or firewall to the internet. The core functionality of the FRP project is implemented across several directories, including the client, server, and plugin components.

The client directory contains the implementation of the FRP client, which is responsible for establishing and maintaining the connection with the FRP server, managing the lifecycle of proxies and visitors, and handling various message types exchanged with the server. The client supports different proxy types, such as TCP, UDP, SUDP, and XTCP, and manages their lifecycle using the proxy.Manager struct. The visitor functionality is handled by the visitor.Manager, which manages different visitor types like STCP, XTCP, and SUDP. The client also provides an HTTP-based administrative API, allowing users to perform operations like reloading the configuration and retrieving the current status.

The server directory contains the implementation of the FRP server, which is responsible for managing the various proxies, visitors, and the control connection with the FRP client. The server supports different proxy types, including HTTP, HTTPS, TCP, UDP, STCP, SUDP, and XTCP, and manages them using the proxy.Manager struct. The server also handles group-related functionality, such as managing HTTP, TCP, and TCP multiplexer proxy groups, using the group package. The server's control connection with the client is managed by the Control struct, which handles client requests and manages the lifecycle of proxies.

The FRP project relies on several key technologies and algorithms, including:

  • NAT Hole Punching: The …/nathole directory contains the core functionality for handling NAT (Network Address Translation) hole punching, which allows the FRP client and server to establish connections even when they are behind different NAT devices.
  • Authentication and Authorization: The …/auth directory provides the implementation of the authentication and authorization mechanisms used in the FRP project, supporting both token-based and OpenID Connect (OIDC) authentication.
  • Metrics and Monitoring: The …/metrics directory manages the metrics functionality in the FRP server, providing support for both memory-based and Prometheus-based metrics.
  • Configuration Management: The …/config directory handles the configuration management and validation logic for the FRP client and server, supporting various file formats and template rendering.

The FRP project is designed with a modular and extensible architecture, allowing for the addition of new proxy types, visitor types, and server-side plugins through well-defined interfaces and extension points.

Client Functionality
Revise

References: client

The client directory contains the core functionality of the FRP (Fast Reverse Proxy) client application. It is responsible for establishing and maintaining the connection with the FRP server, managing the lifecycle of proxies and visitors, and handling various message types exchanged with the server.

Read more

Proxy Management
Revise

References: client/proxy

• • •
Architecture Diagram for Proxy Management
Architecture Diagram for Proxy Management

The …/proxy directory contains the implementation of various proxy types used in the FRP (Fast Reverse Proxy) client. The main components in this directory are:

Read more

Visitor Management
Revise

References: client/visitor

• • •
Architecture Diagram for Visitor Management
Architecture Diagram for Visitor Management

This subsection covers the implementation of the visitor functionality in the FRP client, including the management of different visitor types and the establishment of connections with the FRP server.

Read more

Health Monitoring
Revise

References: client/health

The …/health directory contains the implementation of the health monitoring system for the FRP client. The core component is the Monitor struct, which is responsible for performing health checks on network endpoints and managing their status.

Read more

Event Handling
Revise

References: client/event

• • •
Architecture Diagram for Event Handling
Architecture Diagram for Event Handling

The event.go file in the …/event directory defines the core functionality for handling events in the FRP client, including the management of the lifecycle of proxies.

Read more

Control Connection
Revise

References: client, pkg/msg

The Control struct in the …/control.go file is responsible for managing the client-side functionality of the FRP application, including the following key responsibilities:

Read more

Administrative API
Revise

References: client

The admin_api.go file in the client directory provides an HTTP-based administrative API for the FRP client. This API allows users to perform various operations on the FRP client, such as reloading the configuration, stopping the client, and retrieving the current status and configuration.

Read more

Client Service
Revise

References: client

The frp/client/service.go file provides the implementation of the client service for the FRP (Fast Reverse Proxy) project. The Service struct is the main entry point for the client service, responsible for connecting to the FRP server, managing proxy and visitor configurations, and gracefully closing the service.

Read more

Server Functionality
Revise

References: server

The server directory is the central hub for managing the server-side functionality of the FRP (Fast Reverse Proxy) application. It contains several sub-directories and files that collectively provide the core functionality of the FRP server.

Read more

Proxy Management
Revise

References: server/proxy

• • •
Architecture Diagram for Proxy Management
Architecture Diagram for Proxy Management

The …/proxy directory contains the core functionality for managing and running various types of proxy servers in the FRP (Fast Reverse Proxy) server. The main components and their responsibilities are:

Read more

Group Management
Revise

References: server/group

The …/group directory contains the implementation of group-related functionality in the FRP (Frp Reverse Proxy) server. This includes the management of HTTP proxy groups, TCP proxy groups, and TCP multiplexer groups.

Read more

Visitor Management
Revise

References: server/visitor

• • •
Architecture Diagram for Visitor Management
Architecture Diagram for Visitor Management

The …/visitor directory contains the implementation of the visitor connection manager for the FRP (Fast Reverse Proxy) server. The Manager struct in the visitor.go file is the primary component responsible for managing visitor listeners, which are used to handle incoming visitor connections.

Read more

Port Management
Revise

References: server/ports

The …/ports directory contains the implementation of the port management functionality for the FRP server. The main component in this directory is the Manager struct, which is responsible for allocating and releasing network ports for the FRP server.

Read more

Metrics and Monitoring
Revise

References: server/metrics

• • •
Architecture Diagram for Metrics and Monitoring
Architecture Diagram for Metrics and Monitoring

The …/metrics directory contains the implementation of the server-side metrics functionality in the FRP project. This subsection covers the key components and design decisions in this implementation.

Read more

Resource Management
Revise

References: server/controller

The ResourceController in the …/controller directory is the central hub for managing the various resources and controllers in the FRP server. It provides a unified interface to access and interact with the different components that handle the core functionality of the server.

Read more

Control Connection
Revise

• • •
Architecture Diagram for Control Connection
Architecture Diagram for Control Connection

The control.go file in the server package contains the implementation of the Control struct, which is responsible for managing the control connection between the FRP server and the FRP client. The Control struct handles various client requests, such as creating new proxies, handling ping messages, and closing proxies.

Read more

Dashboard API
Revise

The Dashboard API in the FRP (Fast Reverse Proxy) server provides a set of endpoints for retrieving information about the server and managing its proxies. The main functionality of this API is implemented in the …/dashboard_api.go file.

Read more

Configuration Management
Revise

References: pkg/config

The …/config directory in the FRP (Fast Reverse Proxy) project contains the core functionality for managing and validating the configuration of the FRP client and server. This directory is divided into several sub-directories and files, each with its own specific responsibilities.

Read more

Configuration Management Overview
Revise

References: pkg/config

The …/config directory in the FRP (Fast Reverse Proxy) project contains the core functionality for managing and validating the configuration of the FRP client and server. This directory is divided into several sub-directories and files, each with its own specific responsibilities:

Read more

Legacy Configuration Handling
Revise

References: pkg/config/legacy

The …/legacy directory in the FRP (Fast Reverse Proxy) project contains the implementation of the legacy configuration handling for the FRP client and server. The key functionality in this directory includes:

Read more

v1 Configuration Format
Revise

• • •
Architecture Diagram for v1 Configuration Format
Architecture Diagram for v1 Configuration Format

The …/v1 directory contains the configuration management and validation logic for the FRP (Fast Reverse Proxy) project. It defines the various configuration structures, including those for the client, server, proxies, and visitors, as well as the functionality to validate and complete these configurations.

Read more

Configuration Utilities
Revise

References: pkg/config/types

The …/types directory contains utility functions and custom data types used throughout the configuration management of the FRP (Fast Reverse Proxy) application. The main components are:

Read more

Configuration Loading and Parsing
Revise

• • •
Architecture Diagram for Configuration Loading and Parsing
Architecture Diagram for Configuration Loading and Parsing

The frp/pkg/config/load.go file provides the core functionality for loading and parsing configuration files in various formats for the FRP (Fast Reverse Proxy) project. It supports JSON, YAML, and TOML configuration formats, as well as the legacy INI-based configuration format.

Read more

Command-line Flags
Revise

• • •
Architecture Diagram for Command-line Flags
Architecture Diagram for Command-line Flags

The frp/pkg/config/flags.go file provides functionality for registering and handling command-line flags for the FRP application. It defines several custom flag types, such as BandwidthQuantityFlag and PortsRangeSliceFlag, and provides functions to register flags for different components of the FRP application.

Read more

Utility Functions
Revise

References: pkg/util

The …/util directory contains a collection of utility functions and types that are used throughout the FRP (Fast Reverse Proxy) project. The directory is organized into several sub-directories, each providing specific functionality.

Read more

HTTP Utility Functions
Revise

References: pkg/util/http

The …/http directory provides utility functions for working with HTTP requests and responses in the FRP (Fast Reverse Proxy) project. The main functionality includes:

Read more

HTTP Server Implementation
Revise

References: pkg/util/http

• • •
Architecture Diagram for HTTP Server Implementation
Architecture Diagram for HTTP Server Implementation

The …/server.go file provides an implementation of an HTTP server with support for TLS, authentication, and profiling. The core functionality is encapsulated in the Server struct, which manages the server's lifecycle, and the RouterRegisterHelper struct, which helps with registering routes and applying middleware.

Read more

Logging Utility
Revise

References: pkg/util/log

• • •
Architecture Diagram for Logging Utility
Architecture Diagram for Logging Utility

The …/log directory contains the centralized and configurable logging system for the FRP project. This logging system can output logs to either the console or a rotating log file, and provides convenience functions for logging at different severity levels.

Read more

Metrics Utilities
Revise

References: pkg/util/metric

The …/metric directory contains several files that define different types of metrics for the Frp Reverse Proxy (FRP) project. The main components in this directory are:

Read more

Network Utilities
Revise

References: pkg/util/net

The …/net directory contains various utility functions and types related to network connectivity and handling in the FRP (Fast Reverse Proxy) project. The main functionalities provided in this directory include:

Read more

System Compatibility
Revise

References: pkg/util/system

• • •
Architecture Diagram for System Compatibility
Architecture Diagram for System Compatibility

The …/system directory contains utility functions and code to address compatibility issues on different systems, particularly Android devices. The main functionality in this directory is focused on fixing issues related to timezone and DNS resolution on Android platforms.

Read more

TCP Multiplexer
Revise

References: pkg/util/tcpmux

The …/tcpmux directory contains an implementation of an HTTP CONNECT TCP multiplexer. The main functionality is provided by the HTTPConnectTCPMuxer struct, which is responsible for handling HTTP CONNECT requests and forwarding the connection to the appropriate backend service.

Read more

General Utilities
Revise

References: pkg/util/util

The …/util directory contains a collection of general utility functions that are used throughout the FRP project. These utilities provide functionality for generating random IDs, calculating authentication keys, parsing range numbers, handling response errors, and other common tasks.

Read more

Logging Prefix Management
Revise

References: pkg/util/xlog

• • •
Architecture Diagram for Logging Prefix Management
Architecture Diagram for Logging Prefix Management

The …/xlog directory provides a custom logging utility for the FRP project, allowing developers to manage and display log prefixes. The core functionality is implemented in the xlog.go file and the ctx.go file.

Read more

Backoff Strategies
Revise

References: pkg/util/wait

• • •
Architecture Diagram for Backoff Strategies
Architecture Diagram for Backoff Strategies

The …/wait directory provides utility functions and types for implementing backoff strategies, which are commonly used in distributed systems to handle transient failures and network issues.

Read more

Version Management
Revise

References: pkg/util/version

• • •
Architecture Diagram for Version Management
Architecture Diagram for Version Management

The …/version.go file defines a single variable version that holds the current version of the FRP software. This variable is initialized to the string "0.56.0", which likely represents the version of the FRP software being developed.

Read more

Virtual Host (vhost) System
Revise

References: pkg/util/vhost

• • •
Architecture Diagram for Virtual Host (vhost) System
Architecture Diagram for Virtual Host (vhost) System

The virtual host (vhost) system in the FRP project is implemented in the …/vhost directory. This system provides an HTTP reverse proxy and an HTTPS multiplexer to handle routing of traffic based on the hostname.

Read more

Plugins
Revise

References: pkg/plugin

• • •
Architecture Diagram for Plugins
Architecture Diagram for Plugins

The FRP project provides a flexible plugin system for both the client and server components, allowing developers to extend the functionality of the system.

Read more

Client-Side Plugins
Revise

References: pkg/plugin/client

The …/client directory contains the implementation of various client-side plugins for the FRP (Fast Reverse Proxy) project. These plugins allow the FRP client to handle different types of connections, such as HTTP, HTTPS, SOCKS5, and Unix domain sockets.

Read more

Server-Side Plugins
Revise

References: pkg/plugin/server

• • •
Architecture Diagram for Server-Side Plugins
Architecture Diagram for Server-Side Plugins

The …/server directory contains the server-side plugin functionality for the FRP (Fast Reverse Proxy) project. The main components in this directory are:

Read more

Messaging and Communication
Revise

References: pkg/msg

• • •
Architecture Diagram for Messaging and Communication
Architecture Diagram for Messaging and Communication

The …/msg directory contains the core message types and communication functionality for the FRP (Fast Reverse Proxy) project. It defines various message structures, such as Login, NewProxy, NewVisitorConn, and others, which are used for the communication between the FRP client (frpc) and server (frps).

Read more

Metrics and Monitoring
Revise

References: pkg/metrics

• • •
Architecture Diagram for Metrics and Monitoring
Architecture Diagram for Metrics and Monitoring

The …/metrics directory provides the metrics and monitoring functionality for the FRP server. This includes the implementation of server-level and proxy-level metrics, as well as the ability to enable different metrics systems such as memory-based and Prometheus-based metrics.

Read more

Server-Side Metrics Implementation
Revise

• • •
Architecture Diagram for Server-Side Metrics Implementation
Architecture Diagram for Server-Side Metrics Implementation

The …/aggregate directory contains the implementation of the server-side metrics system for the FRP (Fast Reverse Proxy) project. The main functionality is provided by the serverMetrics struct, which acts as a central hub for managing different metrics systems that can be enabled, such as memory-based metrics and Prometheus-based metrics.

Read more

Metrics Aggregation
Revise

• • •
Architecture Diagram for Metrics Aggregation
Architecture Diagram for Metrics Aggregation

The serverMetrics struct in the …/server.go file acts as a central hub for managing the different metrics systems that can be enabled in the FRP project. This struct is defined and initialized in the init() function.

Read more

Memory-Based Metrics
Revise

The …/mem directory contains the implementation of the memory-based metrics system for the FRP (Fast Reverse Proxy) project. This subsection covers the key aspects of this implementation, including the management of server-level and proxy-level statistics, as well as the periodic clearing of offline proxy data.

Read more

Prometheus-Based Metrics
Revise

• • •
Architecture Diagram for Prometheus-Based Metrics
Architecture Diagram for Prometheus-Based Metrics

The frp/pkg/metrics/prometheus/server.go file defines the Prometheus-based metrics system for the FRP server. This system exposes various metrics related to the server's operation, such as the number of clients, proxies, connections, and traffic in and out.

Read more

Authentication and Authorization
Revise

References: pkg/auth

The FRP project provides a flexible and extensible authentication system, supporting two main authentication methods: token-based authentication and OpenID Connect (OIDC) authentication.

Read more

Token-Based Authentication
Revise

References: pkg/auth/token.go

The TokenAuthSetterVerifier struct in …/token.go is responsible for managing the token-based authentication mechanism in the FRP project. This struct is used to set and verify authentication tokens in various FRP-related messages, such as Login, Ping, and NewWorkConn.

Read more

OIDC Authentication
Revise

References: pkg/auth/oidc.go

• • •
Architecture Diagram for OIDC Authentication
Architecture Diagram for OIDC Authentication

The oidc.go file in the …/auth directory contains the implementation of the OIDC (OpenID Connect) authentication mechanism used in the FRP (Fast Reverse Proxy) project.

Read more

Authentication Interfaces
Revise

References: pkg/auth/auth.go

The auth.go file in the …/auth directory defines two main interfaces: Setter and Verifier, which are used to set and verify authentication credentials, respectively, in the FRP (Fast Reverse Proxy) project.

Read more

Legacy Authentication
Revise

• • •
Architecture Diagram for Legacy Authentication
Architecture Diagram for Legacy Authentication

The legacy.go file in the …/legacy package defines the configuration structures and default values for the legacy authentication methods used in the FRP (Fast Reverse Proxy) project. This includes the configuration options for both the client and server.

Read more

Simple "Always Pass" Authentication
Revise

References: pkg/auth/pass.go

• • •
Architecture Diagram for Simple "Always Pass" Authentication
Architecture Diagram for Simple "Always Pass" Authentication

The frp/pkg/auth/pass.go file contains an implementation of a simple "always pass" authentication mechanism for the FRP (Fast Reverse Proxy) project. This mechanism can be useful for testing or development purposes, where a simple authentication solution is required.

Read more

NAT Hole Punching
Revise

References: pkg/nathole

The core functionality for handling NAT (Network Address Translation) hole punching in the FRP project is implemented in the …/nathole directory. This directory contains several key components that work together to provide a robust and reliable NAT hole-punching solution.

Read more

NAT Feature Analysis and Recommendation
Revise

• • •
Architecture Diagram for NAT Feature Analysis and Recommendation
Architecture Diagram for NAT Feature Analysis and Recommendation

The analysis.go file in the …/nathole package contains the core functionality for analyzing the network address translation (NAT) features of clients and visitors, and recommending the appropriate hole-punching strategy.

Read more

NAT Feature Classification
Revise

• • •
Architecture Diagram for NAT Feature Classification
Architecture Diagram for NAT Feature Classification

The classify.go file in the …/nathole package provides functionality for classifying the NAT (Network Address Translation) type and behavior of network addresses. The main functionality is provided by the ClassifyNATFeature() function, which takes a list of network addresses and local IP addresses, and returns a NatFeature object with the classified NAT type and behavior.

Read more

NAT Hole-Punching Controller
Revise

The Controller struct in the …/controller.go file is the central component responsible for managing the NAT hole-punching functionality in the FRP project. The Controller is responsible for the following key tasks:

Read more

NAT Discovery
Revise

• • •
Architecture Diagram for NAT Discovery
Architecture Diagram for NAT Discovery

The Discover() function in the …/discovery.go file is responsible for discovering the external IP address of the client by sending STUN requests to the provided STUN servers.

Read more

NAT Hole-Punching Logic
Revise

• • •
Architecture Diagram for NAT Hole-Punching Logic
Architecture Diagram for NAT Hole-Punching Logic

The MakeHole() function in the …/nathole.go file is responsible for the core NAT hole punching logic in the FRP project. This function is called after the client and server have exchanged information about their NAT types and behaviors, and it is tasked with actually creating a hole in the NAT to establish a direct connection between the two parties.

Read more

Utility Functions
Revise

The utils.go file in the …/nathole directory provides various utility functions used throughout the NAT hole-punching implementation.

Read more