代理配置

frp 代理的详细配置说明。

ProxyBaseConfig

Field Type Description Required
name string 代理名称。 Yes
type string 代理类型,可选值为 tcp, udp, http, https, tcpmux, stcp, sudp, xtcp。 Yes
transport ProxyTransport 代理网络层配置。 No
metadatas map[string]string 附加元数据,会传递给服务端插件,提供附加能力。 No
loadBalancer LoadBalancerConfig 负载均衡配置。 No
healthCheck HealthCheckConfig 健康检查配置。 No
ProxyBackend 代理后端服务配置。 Yes

ProxyTransport

Field Type Description Required
useEncryption bool 是否启用加密功能,启用后该代理和服务端之间的通信内容都会被加密传输,如果 frpc 启用了全局 TLS,则不需要再启用此参数。 No
useCompression bool 是否启用压缩功能,启用后该代理和服务端之间的通信内容都会被压缩传输。 No
bandwidthLimit string 设置单个 proxy 的带宽限流,单位为 MB 或 KB,0 表示不限制,如果启用,默认会作用于对应的 frpc。 No
bandwidthLimitMode string 限流类型,客户端限流或服务端限流,可选值为 client 和 server,默认为客户端限流。 No
proxyProtocolVersion string 启用 proxy protocol 协议的版本,可选值为 v1 和 v2。如果启用,则 frpc 和本地服务建立连接后会发送 proxy protocol 的协议,包含了原请求的 IP 地址和端口等内容。 No

ProxyBackend

Field Type Description Required
localIP string 被代理的本地服务 IP,默认为 127.0.0.1。 No
localPort int 被代理的本地服务端口。 No
plugin ClientPluginOptions 客户端插件配置,如果启用了客户端插件,则不需要配置 localIP 和 localPort,流量会由客户端插件接管。不同的插件类型对应不同的配置,例如 HTTPProxyPluginOptions No

LoadBalancerConfig

Field Type Description Required
group string 负载均衡分组名称,用户请求会以轮询的方式发送给同一个 group 中的代理。 Yes
groupKey string 负载均衡分组密钥,用于对负载均衡分组进行鉴权,groupKey 相同的代理才会被加入到同一个分组中。 No

HealthCheckConfig

Field Type Description Required
type string 健康检查类型,可选值为 tcp 和 http,配置后启用健康检查功能,tcp 是连接成功则认为服务健康,http 要求接口返回 2xx 的状态码则认为服务健康。 Yes
timeoutSeconds int 健康检查超时时间(秒),默认为 3s。 No
maxFailed int 健康检查连续错误次数,连续检查错误多少次认为服务不健康,默认为 1。 No
intervalSeconds int 健康检查周期(秒),每隔多长时间进行一次健康检查,默认为 10s。 No
path string 健康检查的 HTTP 接口,如果健康检查类型是 http,则需要配置此参数,指定发送 http 请求的 path,例如 /health No

DomainConfig

Field Type Description Required
customDomains []string 自定义域名列表。 No
subdomain string 子域名。 No

TCPProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
remotePort int 服务端绑定的端口,用户访问服务端此端口的流量会被转发到对应的本地服务。 No

UDPProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
remotePort int 服务端绑定的端口,用户访问服务端此端口的流量会被转发到对应的本地服务。 No

HTTPProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
DomainConfig 域名配置。 Yes
locations []string URL 路由配置。 No
httpUser string HTTP Basic Auth 用户名。 No
httpPassword string HTTP Basic Auth 密码。 No
hostHeaderRewrite string 替换 Host Header。 No
requestHeaders HeaderOperations 对请求 Header 的操作配置。 No
routeByHTTPUser string 根据 HTTP Basic Auth user 路由。 No

HTTPSProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
DomainConfig 域名配置。 Yes

TCPMuxProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
DomainConfig 域名配置。 Yes
httpUser string 用户名,如果配置此参数,通过 HTTP CONNECT 建立连接时需要通过 Proxy-Authorization 附加上正确的身份信息。 No
httpPassword string 密码。 No
routeByHTTPUser string 根据 HTTP Basic Auth user 路由。 No
multiplexer string 复用器类型,目前仅支持 httpconnect。 No

STCPProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
secretKey string 密钥,服务端和访问端的密钥需要一致,访问端才能访问到服务端。 No
allowUsers []string 允许访问的 visitor 用户列表,默认只允许同一用户下的 visitor 访问,配置为 * 则允许任何 visitor 访问。 No

XTCPProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
secretKey string 密钥,服务端和访问端的密钥需要一致,访问端才能访问到服务端。 No
allowUsers []string 允许访问的 visitor 用户列表,默认只允许同一用户下的 visitor 访问,配置为 * 则允许任何 visitor 访问。 No

SUDPProxyConfig

Field Type Description Required
ProxyBaseConfig 基础配置。 Yes
secretKey string 密钥,服务端和访问端的密钥需要一致,访问端才能访问到服务端。 No
allowUsers []string 允许访问的 visitor 用户列表,默认只允许同一用户下的 visitor 访问,配置为 * 则允许任何 visitor 访问。 No
最后修改 November 15, 2023: fix 404 (#71) (626ce4d)

Agent Configuration

frp Agent A detailed Configuration description of.

ProxyBaseConfig

Field Type Description Required
name string Agent Name. Yes
type string Agent Type, optional values are tcp, udp, http, https, tcpmux, stcp, sudp, xtcp。 Yes
transport ProxyTransport Agent Network layer Configuration. No
metadatas map[string]string Additional metadata, which is passed to Server side Plug-in to provide additional capabilities. No
loadBalancer LoadBalancerConfig Load balancer Configuration. No
healthCheck HealthCheckConfig Health check Configuration. No
ProxyBackend Agent Backend service Configuration. Yes

ProxyTransport

Field Type Description Required
useEncryption bool Whether to enable the encryption function, after enabling the Agent and Server side. All communications between them will be encrypted if global is enabled by frpc. TLS, you no longer need to enable this parameter. No
useCompression bool Whether to enable the compression function, after enabling the Agent and Server side. The content of communication between them will be compressed and transmitted. No
bandwidthLimit string Set the bandwidth limit for a single proxy (in MB or KB,0). Means there is no limit. If enabled, the default will be applied to the corresponding frpc. No
bandwidthLimitMode string Current limit type, Client current limit or Server side current limit. Available value is client. And server, the default is Client current limit. No
proxyProtocolVersion string Enable the version of the proxy protocol protocol, optional values are v1 and. V2 . If enabled, proxy will be sent after the frpc and the local service establish a connection. The protocol of protocol, including the IP address and port of the original request. No

ProxyBackend

Field Type Description Required
localIP string The local service IP that is Agent defaults to 127.0.0.1. No
localPort int The local Server side port of Agent. No
plugin ClientPluginOptions ClientPlug in Configuration, if ClientPlug in is enabled, Configuration is not required LocalIP and LocalPort, the traffic will be taken over by ClientPlug in. Different Plug in types correspond to different configurations, for example HTTPProxyPluginOptions. No

LoadBalancerConfig

Field Type Description Required
group string Load balancer packet name, and the user request will be sent to the same user by polling. Agent in group. Yes
groupKey string Cloud load balancer packet key, which is used to authenticate the load balancer packet, groupKey. The same Agent will be added to the same group. No

HealthCheckConfig

Field Type Description Required
type string Health check type. Available values are tcp and. Enable health check function after http,Configuration, tcp. If the connection is successful, the service is considered healthy. Http requires the API to return 2xx. The status code is considered to serve the health. Yes
timeoutSeconds int The health check timeout (seconds), which defaults to 3 seconds. No
maxFailed int The number of consecutive errors in health check, and how many consecutive errors are considered to be unhealthy service. Default is. one. No
intervalSeconds int Health check-up cycle (seconds). How often do you have a health check? default is. 10s . No
path string The HTTP interface for health check, if the health check type is. Http, the parameter Configuration is required to specify the. Path, for example /health No

DomainConfig

Field Type Description Required
customDomains []string Customize the list of domain names. No
subdomain string Subdomain name. No

TCPProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
remotePort int Port bound by Server side, and user accesses Server side. Traffic from this port is forwarded to the corresponding local service. No

UDPProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
remotePort int Port bound by Server side, and user accesses Server side. Traffic from this port is forwarded to the corresponding local service. No

HTTPProxyConfig

Field Type Description Required
ProxyBaseConfig Basics Configuration。 Yes
DomainConfig Domain name Configuration. Yes
locations []string URL RoutinConfiguration。 No
httpUser string HTTP Basic Auth User name. No
httpPassword string HTTP Basic Auth Password. No
hostHeaderRewrite string Replace Host Header。 No
requestHeaders HeaderOperations The operation Configuration for the request Header. No
routeByHTTPUser string According to HTTP Basic Auth user Routin。 No

HTTPSProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
DomainConfig Domain name Configuration. Yes

TCPMuxProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
DomainConfig Domain name Configuration. Yes
httpUser string User name, if Configuration this parameter, through HTTP CONNECT. Proxy-Authorization is required to establish a connection. Attach the correct identity information. No
httpPassword string Password No
routeByHTTPUser string According to HTTP Basic Auth user Routin。 No
multiplexer string Multiplexer type, currently only supported httpconnect。 No

STCPProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
secretKey string Key, Server side. The key of the access side needs to be consistent with that of the access side before the access side can access the Server side. No
allowUsers []string List of visitor users allowed to access. By default, only those under the same user are allowed. Visitor access. If Configuration is *, any visitor is allowed. Visit. No

XTCPProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
secretKey string Key, Server side. The key of the access side needs to be consistent with that of the access side before the access side can access the Server side. No
allowUsers []string List of visitor users allowed to access. By default, only those under the same user are allowed. Visitor access. If Configuration is *, any visitor is allowed. Visit. No

SUDPProxyConfig

Field Type Description Required
ProxyBaseConfig Basic Configuration. Yes
secretKey string Key, Server side. The key of the access side needs to be consistent with that of the access side before the access side can access the Server side. No
allowUsers []string List of visitor users allowed to access. By default, only those under the same user are allowed. Visitor access. If Configuration is *, any visitor is allowed. Visit. No
Last modified November 15, 2023: fix 404 (#71) (626ce4d)