Documentation
¶
Index ¶
- Constants
- Variables
- type APIMetadata
- type AuthClientConfig
- type AuthMethod
- type AuthOIDCClientConfig
- type AuthOIDCServerConfig
- type AuthScope
- type AuthServerConfig
- type ClientCommonConfig
- type ClientConfig
- type ClientPluginOptions
- type ClientTransportConfig
- type DomainConfig
- type HTTP2HTTPPluginOptions
- type HTTP2HTTPSPluginOptions
- type HTTPHeader
- type HTTPPluginOptions
- type HTTPProxyConfig
- type HTTPProxyPluginOptions
- type HTTPS2HTTPPluginOptions
- type HTTPS2HTTPSPluginOptions
- type HTTPSProxyConfig
- type HeaderOperations
- type HealthCheckConfig
- type LoadBalancerConfig
- type LogConfig
- type ProxyBackend
- type ProxyBaseConfig
- type ProxyConfigurer
- type ProxyTransport
- type ProxyType
- type QUICOptions
- type SSHTunnelGateway
- type STCPProxyConfig
- type STCPVisitorConfig
- type SUDPProxyConfig
- type SUDPVisitorConfig
- type ServerConfig
- type ServerTransportConfig
- type Socks5PluginOptions
- type StaticFilePluginOptions
- type TCPMultiplexerType
- type TCPMuxProxyConfig
- type TCPProxyConfig
- type TLSClientConfig
- type TLSConfig
- type TLSServerConfig
- type TypedClientPluginOptions
- type TypedProxyConfig
- type TypedVisitorConfig
- type UDPProxyConfig
- type UnixDomainSocketPluginOptions
- type VisitorBaseConfig
- type VisitorConfigurer
- type VisitorTransport
- type VisitorType
- type WebServerConfig
- type XTCPProxyConfig
- type XTCPVisitorConfig
Constants ¶
View Source
const ( PluginHTTP2HTTPS = "http2https" PluginHTTPProxy = "http_proxy" PluginHTTPS2HTTP = "https2http" PluginHTTPS2HTTPS = "https2https" PluginHTTP2HTTP = "http2http" PluginSocks5 = "socks5" PluginStaticFile = "static_file" PluginUnixDomainSocket = "unix_domain_socket" )
Variables ¶
View Source
var ( DisallowUnknownFields = false DisallowUnknownFieldsMu sync.Mutex )
TODO(fatedier): Due to the current implementation issue of the go json library, the UnmarshalJSON method of a custom struct cannot access the DisallowUnknownFields parameter of the parent decoder. Here, a global variable is temporarily used to control whether unknown fields are allowed. Once the v2 version is implemented by the community, we can switch to a standardized approach.
https://github.com/golang/go/issues/41144 https://github.com/golang/go/discussions/63397
Functions ¶
This section is empty.
Types ¶
type APIMetadata ¶
type APIMetadata struct {
Version string `json:"version"`
}
type AuthClientConfig ¶
type AuthClientConfig struct {
// Method specifies what authentication method to use to
// authenticate frpc with frps. If "token" is specified - token will be
// read into login message. If "oidc" is specified - OIDC (Open ID Connect)
// token will be issued using OIDC settings. By default, this value is "token".
Method AuthMethod `json:"method,omitempty"`
// Specify whether to include auth info in additional scope.
// Current supported scopes are: "HeartBeats", "NewWorkConns".
AdditionalScopes []AuthScope `json:"additionalScopes,omitempty"`
// Token specifies the authorization token used to create keys to be sent
// to the server. The server must have a matching token for authorization
// to succeed. By default, this value is "".
Token string `json:"token,omitempty"`
OIDC AuthOIDCClientConfig `json:"oidc,omitempty"`
}
func (*AuthClientConfig) Complete ¶
func (c *AuthClientConfig) Complete()
type AuthMethod ¶
type AuthMethod string
const ( AuthMethodToken AuthMethod = "token" AuthMethodOIDC AuthMethod = "oidc" )
type AuthOIDCClientConfig ¶
type AuthOIDCClientConfig struct {
// ClientID specifies the client ID to use to get a token in OIDC authentication.
ClientID string `json:"clientID,omitempty"`
// ClientSecret specifies the client secret to use to get a token in OIDC
// authentication.
ClientSecret string `json:"clientSecret,omitempty"`
// Audience specifies the audience of the token in OIDC authentication.
Audience string `json:"audience,omitempty"`
// Scope specifies the scope of the token in OIDC authentication.
Scope string `json:"scope,omitempty"`
// TokenEndpointURL specifies the URL which implements OIDC Token Endpoint.
// It will be used to get an OIDC token.
TokenEndpointURL string `json:"tokenEndpointURL,omitempty"`
// AdditionalEndpointParams specifies additional parameters to be sent
// this field will be transfer to map[string][]string in OIDC token generator.
AdditionalEndpointParams map[string]string `json:"additionalEndpointParams,omitempty"`
}
type AuthOIDCServerConfig ¶
type AuthOIDCServerConfig struct {
// Issuer specifies the issuer to verify OIDC tokens with. This issuer
// will be used to load public keys to verify signature and will be compared
// with the issuer claim in the OIDC token.
Issuer string `json:"issuer,omitempty"`
// Audience specifies the audience OIDC tokens should contain when validated.
// If this value is empty, audience ("client ID") verification will be skipped.
Audience string `json:"audience,omitempty"`
// SkipExpiryCheck specifies whether to skip checking if the OIDC token is
// expired.
SkipExpiryCheck bool `json:"skipExpiryCheck,omitempty"`
// SkipIssuerCheck specifies whether to skip checking if the OIDC token's
// issuer claim matches the issuer specified in OidcIssuer.
SkipIssuerCheck bool `json:"skipIssuerCheck,omitempty"`
}
type AuthServerConfig ¶
type AuthServerConfig struct {
Method AuthMethod `json:"method,omitempty"`
AdditionalScopes []AuthScope `json:"additionalScopes,omitempty"`
Token string `json:"token,omitempty"`
OIDC AuthOIDCServerConfig `json:"oidc,omitempty"`
}
func (*AuthServerConfig) Complete ¶
func (c *AuthServerConfig) Complete()
type ClientCommonConfig ¶
type ClientCommonConfig struct {
APIMetadata
Auth AuthClientConfig `json:"auth,omitempty"`
// User specifies a prefix for proxy names to distinguish them from other
// clients. If this value is not "", proxy names will automatically be
// changed to "{user}.{proxy_name}".
User string `json:"user,omitempty"`
// ServerAddr specifies the address of the server to connect to. By
// default, this value is "0.0.0.0".
ServerAddr string `json:"serverAddr,omitempty"`
// ServerPort specifies the port to connect to the server on. By default,
// this value is 7000.
ServerPort int `json:"serverPort,omitempty"`
// STUN server to help penetrate NAT hole.
NatHoleSTUNServer string `json:"natHoleStunServer,omitempty"`
// DNSServer specifies a DNS server address for FRPC to use. If this value
// is "", the default DNS will be used.
DNSServer string `json:"dnsServer,omitempty"`
// LoginFailExit controls whether or not the client should exit after a
// failed login attempt. If false, the client will retry until a login
// attempt succeeds. By default, this value is true.
LoginFailExit *bool `json:"loginFailExit,omitempty"`
// Start specifies a set of enabled proxies by name. If this set is empty,
// all supplied proxies are enabled. By default, this value is an empty
// set.
Start []string `json:"start,omitempty"`
Log LogConfig `json:"log,omitempty"`
WebServer WebServerConfig `json:"webServer,omitempty"`
Transport ClientTransportConfig `json:"transport,omitempty"`
// UDPPacketSize specifies the udp packet size
// By default, this value is 1500
UDPPacketSize int64 `json:"udpPacketSize,omitempty"`
// Client metadata info
Metadatas map[string]string `json:"metadatas,omitempty"`
// Include other config files for proxies.
IncludeConfigFiles []string `json:"includes,omitempty"`
}
func (*ClientCommonConfig) Complete ¶
func (c *ClientCommonConfig) Complete()
type ClientConfig ¶
type ClientConfig struct {
ClientCommonConfig
Proxies []TypedProxyConfig `json:"proxies,omitempty"`
Visitors []TypedVisitorConfig `json:"visitors,omitempty"`
}
type ClientPluginOptions ¶
type ClientPluginOptions interface {
Complete()
}
type ClientTransportConfig ¶
type ClientTransportConfig struct {
// Protocol specifies the protocol to use when interacting with the server.
// Valid values are "tcp", "kcp", "quic", "websocket" and "wss". By default, this value
// is "tcp".
Protocol string `json:"protocol,omitempty"`
// The maximum amount of time a dial to server will wait for a connect to complete.
DialServerTimeout int64 `json:"dialServerTimeout,omitempty"`
// DialServerKeepAlive specifies the interval between keep-alive probes for an active network connection between frpc and frps.
// If negative, keep-alive probes are disabled.
DialServerKeepAlive int64 `json:"dialServerKeepalive,omitempty"`
// ConnectServerLocalIP specifies the address of the client bind when it connect to server.
// Note: This value only use in TCP/Websocket protocol. Not support in KCP protocol.
ConnectServerLocalIP string `json:"connectServerLocalIP,omitempty"`
// ProxyURL specifies a proxy address to connect to the server through. If
// this value is "", the server will be connected to directly. By default,
// this value is read from the "http_proxy" environment variable.
ProxyURL string `json:"proxyURL,omitempty"`
// PoolCount specifies the number of connections the client will make to
// the server in advance.
PoolCount int `json:"poolCount,omitempty"`
// TCPMux toggles TCP stream multiplexing. This allows multiple requests
// from a client to share a single TCP connection. If this value is true,
// the server must have TCP multiplexing enabled as well. By default, this
// value is true.
TCPMux *bool `json:"tcpMux,omitempty"`
// TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multiplier.
// If TCPMux is true, heartbeat of application layer is unnecessary because it can only rely on heartbeat in TCPMux.
TCPMuxKeepaliveInterval int64 `json:"tcpMuxKeepaliveInterval,omitempty"`
// QUIC protocol options.
QUIC QUICOptions `json:"quic,omitempty"`
// HeartBeatInterval specifies at what interval heartbeats are sent to the
// server, in seconds. It is not recommended to change this value. By
// default, this value is 30. Set negative value to disable it.
HeartbeatInterval int64 `json:"heartbeatInterval,omitempty"`
// HeartBeatTimeout specifies the maximum allowed heartbeat response delay
// before the connection is terminated, in seconds. It is not recommended
// to change this value. By default, this value is 90. Set negative value to disable it.
HeartbeatTimeout int64 `json:"heartbeatTimeout,omitempty"`
// TLS specifies TLS settings for the connection to the server.
TLS TLSClientConfig `json:"tls,omitempty"`
}
func (*ClientTransportConfig) Complete ¶
func (c *ClientTransportConfig) Complete()
type DomainConfig ¶
type HTTP2HTTPPluginOptions ¶
type HTTP2HTTPPluginOptions struct {
Type string `json:"type,omitempty"`
LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
}
func (*HTTP2HTTPPluginOptions) Complete ¶
func (o *HTTP2HTTPPluginOptions) Complete()
type HTTP2HTTPSPluginOptions ¶
type HTTP2HTTPSPluginOptions struct {
Type string `json:"type,omitempty"`
LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
}
func (*HTTP2HTTPSPluginOptions) Complete ¶
func (o *HTTP2HTTPSPluginOptions) Complete()
type HTTPHeader ¶
type HTTPPluginOptions ¶
type HTTPProxyConfig ¶
type HTTPProxyConfig struct {
ProxyBaseConfig
DomainConfig
Locations []string `json:"locations,omitempty"`
HTTPUser string `json:"httpUser,omitempty"`
HTTPPassword string `json:"httpPassword,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
ResponseHeaders HeaderOperations `json:"responseHeaders,omitempty"`
RouteByHTTPUser string `json:"routeByHTTPUser,omitempty"`
}
func (*HTTPProxyConfig) MarshalToMsg ¶
func (c *HTTPProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*HTTPProxyConfig) UnmarshalFromMsg ¶
func (c *HTTPProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type HTTPProxyPluginOptions ¶
type HTTPProxyPluginOptions struct {
Type string `json:"type,omitempty"`
HTTPUser string `json:"httpUser,omitempty"`
HTTPPassword string `json:"httpPassword,omitempty"`
}
func (*HTTPProxyPluginOptions) Complete ¶
func (o *HTTPProxyPluginOptions) Complete()
type HTTPS2HTTPPluginOptions ¶
type HTTPS2HTTPPluginOptions struct {
Type string `json:"type,omitempty"`
LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
EnableHTTP2 *bool `json:"enableHTTP2,omitempty"`
CrtPath string `json:"crtPath,omitempty"`
KeyPath string `json:"keyPath,omitempty"`
}
func (*HTTPS2HTTPPluginOptions) Complete ¶
func (o *HTTPS2HTTPPluginOptions) Complete()
type HTTPS2HTTPSPluginOptions ¶
type HTTPS2HTTPSPluginOptions struct {
Type string `json:"type,omitempty"`
LocalAddr string `json:"localAddr,omitempty"`
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
RequestHeaders HeaderOperations `json:"requestHeaders,omitempty"`
EnableHTTP2 *bool `json:"enableHTTP2,omitempty"`
CrtPath string `json:"crtPath,omitempty"`
KeyPath string `json:"keyPath,omitempty"`
}
func (*HTTPS2HTTPSPluginOptions) Complete ¶
func (o *HTTPS2HTTPSPluginOptions) Complete()
type HTTPSProxyConfig ¶
type HTTPSProxyConfig struct {
ProxyBaseConfig
DomainConfig
}
func (*HTTPSProxyConfig) MarshalToMsg ¶
func (c *HTTPSProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*HTTPSProxyConfig) UnmarshalFromMsg ¶
func (c *HTTPSProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type HeaderOperations ¶
type HealthCheckConfig ¶
type HealthCheckConfig struct {
// Type specifies what protocol to use for health checking.
// Valid values include "tcp", "http", and "". If this value is "", health
// checking will not be performed.
//
// If the type is "tcp", a connection will be attempted to the target
// server. If a connection cannot be established, the health check fails.
//
// If the type is "http", a GET request will be made to the endpoint
// specified by HealthCheckURL. If the response is not a 200, the health
// check fails.
Type string `json:"type"` // tcp | http
// TimeoutSeconds specifies the number of seconds to wait for a health
// check attempt to connect. If the timeout is reached, this counts as a
// health check failure. By default, this value is 3.
TimeoutSeconds int `json:"timeoutSeconds,omitempty"`
// MaxFailed specifies the number of allowed failures before the
// is stopped. By default, this value is 1.
MaxFailed int `json:"maxFailed,omitempty"`
// IntervalSeconds specifies the time in seconds between health
// checks. By default, this value is 10.
IntervalSeconds int `json:"intervalSeconds"`
// Path specifies the path to send health checks to if the
// health check type is "http".
Path string `json:"path,omitempty"`
// HTTPHeaders specifies the headers to send with the health request, if
// the health check type is "http".
HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
}
HealthCheckConfig configures health checking. This can be useful for load balancing purposes to detect and remove proxies to failing services.
type LoadBalancerConfig ¶
type LoadBalancerConfig struct {
// Group specifies which group the is a part of. The server will use
// this information to load balance proxies in the same group. If the value
// is "", this will not be in a group.
Group string `json:"group"`
// GroupKey specifies a group key, which should be the same among proxies
// of the same group.
GroupKey string `json:"groupKey,omitempty"`
}
type LogConfig ¶
type LogConfig struct {
// This is destination where frp should write the logs.
// If "console" is used, logs will be printed to stdout, otherwise,
// logs will be written to the specified file.
// By default, this value is "console".
To string `json:"to,omitempty"`
// Level specifies the minimum log level. Valid values are "trace",
// "debug", "info", "warn", and "error". By default, this value is "info".
Level string `json:"level,omitempty"`
// MaxDays specifies the maximum number of days to store log information
// before deletion.
MaxDays int64 `json:"maxDays"`
// DisablePrintColor disables log colors when log.to is "console".
DisablePrintColor bool `json:"disablePrintColor,omitempty"`
}
type ProxyBackend ¶
type ProxyBackend struct {
// LocalIP specifies the IP address or host name of the backend.
LocalIP string `json:"localIP,omitempty"`
// LocalPort specifies the port of the backend.
LocalPort int `json:"localPort,omitempty"`
// Plugin specifies what plugin should be used for handling connections. If this value
// is set, the LocalIP and LocalPort values will be ignored.
Plugin TypedClientPluginOptions `json:"plugin,omitempty"`
}
type ProxyBaseConfig ¶
type ProxyBaseConfig struct {
Name string `json:"name"`
Type string `json:"type"`
Annotations map[string]string `json:"annotations,omitempty"`
Transport ProxyTransport `json:"transport,omitempty"`
// metadata info for each proxy
Metadatas map[string]string `json:"metadatas,omitempty"`
LoadBalancer LoadBalancerConfig `json:"loadBalancer,omitempty"`
HealthCheck HealthCheckConfig `json:"healthCheck,omitempty"`
ProxyBackend
}
func (*ProxyBaseConfig) Complete ¶
func (c *ProxyBaseConfig) Complete(namePrefix string)
func (*ProxyBaseConfig) GetBaseConfig ¶
func (c *ProxyBaseConfig) GetBaseConfig() *ProxyBaseConfig
func (*ProxyBaseConfig) MarshalToMsg ¶
func (c *ProxyBaseConfig) MarshalToMsg(m *msg.NewProxy)
func (*ProxyBaseConfig) UnmarshalFromMsg ¶
func (c *ProxyBaseConfig) UnmarshalFromMsg(m *msg.NewProxy)
type ProxyConfigurer ¶
type ProxyConfigurer interface {
Complete(namePrefix string)
GetBaseConfig() *ProxyBaseConfig
// MarshalToMsg marshals this config into a msg.NewProxy message. This
// function will be called on the frpc side.
MarshalToMsg(*msg.NewProxy)
// UnmarshalFromMsg unmarshal a msg.NewProxy message into this config.
// This function will be called on the frps side.
UnmarshalFromMsg(*msg.NewProxy)
}
func NewProxyConfigurerByType ¶
func NewProxyConfigurerByType(proxyType ProxyType) ProxyConfigurer
type ProxyTransport ¶
type ProxyTransport struct {
// UseEncryption controls whether or not communication with the server will
// be encrypted. Encryption is done using the tokens supplied in the server
// and client configuration.
UseEncryption bool `json:"useEncryption,omitempty"`
// UseCompression controls whether or not communication with the server
// will be compressed.
UseCompression bool `json:"useCompression,omitempty"`
// BandwidthLimit limit the bandwidth
// 0 means no limit
BandwidthLimit types.BandwidthQuantity `json:"bandwidthLimit,omitempty"`
// BandwidthLimitMode specifies whether to limit the bandwidth on the
// client or server side. Valid values include "client" and "server".
// By default, this value is "client".
BandwidthLimitMode string `json:"bandwidthLimitMode,omitempty"`
// ProxyProtocolVersion specifies which protocol version to use. Valid
// values include "v1", "v2", and "". If the value is "", a protocol
// version will be automatically selected. By default, this value is "".
ProxyProtocolVersion string `json:"proxyProtocolVersion,omitempty"`
}
type QUICOptions ¶
type QUICOptions struct {
KeepalivePeriod int `json:"keepalivePeriod,omitempty"`
MaxIdleTimeout int `json:"maxIdleTimeout,omitempty"`
MaxIncomingStreams int `json:"maxIncomingStreams,omitempty"`
}
QUIC protocol options
func (*QUICOptions) Complete ¶
func (c *QUICOptions) Complete()
type SSHTunnelGateway ¶
type SSHTunnelGateway struct {
BindPort int `json:"bindPort,omitempty"`
PrivateKeyFile string `json:"privateKeyFile,omitempty"`
AutoGenPrivateKeyPath string `json:"autoGenPrivateKeyPath,omitempty"`
AuthorizedKeysFile string `json:"authorizedKeysFile,omitempty"`
}
func (*SSHTunnelGateway) Complete ¶
func (c *SSHTunnelGateway) Complete()
type STCPProxyConfig ¶
type STCPProxyConfig struct {
ProxyBaseConfig
Secretkey string `json:"secretKey,omitempty"`
AllowUsers []string `json:"allowUsers,omitempty"`
}
func (*STCPProxyConfig) MarshalToMsg ¶
func (c *STCPProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*STCPProxyConfig) UnmarshalFromMsg ¶
func (c *STCPProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type STCPVisitorConfig ¶
type STCPVisitorConfig struct {
VisitorBaseConfig
}
type SUDPProxyConfig ¶
type SUDPProxyConfig struct {
ProxyBaseConfig
Secretkey string `json:"secretKey,omitempty"`
AllowUsers []string `json:"allowUsers,omitempty"`
}
func (*SUDPProxyConfig) MarshalToMsg ¶
func (c *SUDPProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*SUDPProxyConfig) UnmarshalFromMsg ¶
func (c *SUDPProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type SUDPVisitorConfig ¶
type SUDPVisitorConfig struct {
VisitorBaseConfig
}
type ServerConfig ¶
type ServerConfig struct {
APIMetadata
Auth AuthServerConfig `json:"auth,omitempty"`
// BindAddr specifies the address that the server binds to. By default,
// this value is "0.0.0.0".
BindAddr string `json:"bindAddr,omitempty"`
// BindPort specifies the port that the server listens on. By default, this
// value is 7000.
BindPort int `json:"bindPort,omitempty"`
// KCPBindPort specifies the KCP port that the server listens on. If this
// value is 0, the server will not listen for KCP connections.
KCPBindPort int `json:"kcpBindPort,omitempty"`
// QUICBindPort specifies the QUIC port that the server listens on.
// Set this value to 0 will disable this feature.
QUICBindPort int `json:"quicBindPort,omitempty"`
// ProxyBindAddr specifies the address that the proxy binds to. This value
// may be the same as BindAddr.
ProxyBindAddr string `json:"proxyBindAddr,omitempty"`
// VhostHTTPPort specifies the port that the server listens for HTTP Vhost
// requests. If this value is 0, the server will not listen for HTTP
// requests.
VhostHTTPPort int `json:"vhostHTTPPort,omitempty"`
// VhostHTTPTimeout specifies the response header timeout for the Vhost
// HTTP server, in seconds. By default, this value is 60.
VhostHTTPTimeout int64 `json:"vhostHTTPTimeout,omitempty"`
// VhostHTTPSPort specifies the port that the server listens for HTTPS
// Vhost requests. If this value is 0, the server will not listen for HTTPS
// requests.
VhostHTTPSPort int `json:"vhostHTTPSPort,omitempty"`
// TCPMuxHTTPConnectPort specifies the port that the server listens for TCP
// HTTP CONNECT requests. If the value is 0, the server will not multiplex TCP
// requests on one single port. If it's not - it will listen on this value for
// HTTP CONNECT requests.
TCPMuxHTTPConnectPort int `json:"tcpmuxHTTPConnectPort,omitempty"`
// If TCPMuxPassthrough is true, frps won't do any update on traffic.
TCPMuxPassthrough bool `json:"tcpmuxPassthrough,omitempty"`
// SubDomainHost specifies the domain that will be attached to sub-domains
// requested by the client when using Vhost proxying. For example, if this
// value is set to "frps.com" and the client requested the subdomain
// "test", the resulting URL would be "test.frps.com".
SubDomainHost string `json:"subDomainHost,omitempty"`
// Custom404Page specifies a path to a custom 404 page to display. If this
// value is "", a default page will be displayed.
Custom404Page string `json:"custom404Page,omitempty"`
SSHTunnelGateway SSHTunnelGateway `json:"sshTunnelGateway,omitempty"`
WebServer WebServerConfig `json:"webServer,omitempty"`
// EnablePrometheus will export prometheus metrics on webserver address
// in /metrics api.
EnablePrometheus bool `json:"enablePrometheus,omitempty"`
Log LogConfig `json:"log,omitempty"`
Transport ServerTransportConfig `json:"transport,omitempty"`
// DetailedErrorsToClient defines whether to send the specific error (with
// debug info) to frpc. By default, this value is true.
DetailedErrorsToClient *bool `json:"detailedErrorsToClient,omitempty"`
// MaxPortsPerClient specifies the maximum number of ports a single client
// may proxy to. If this value is 0, no limit will be applied.
MaxPortsPerClient int64 `json:"maxPortsPerClient,omitempty"`
// UserConnTimeout specifies the maximum time to wait for a work
// connection. By default, this value is 10.
UserConnTimeout int64 `json:"userConnTimeout,omitempty"`
// UDPPacketSize specifies the UDP packet size
// By default, this value is 1500
UDPPacketSize int64 `json:"udpPacketSize,omitempty"`
// NatHoleAnalysisDataReserveHours specifies the hours to reserve nat hole analysis data.
NatHoleAnalysisDataReserveHours int64 `json:"natholeAnalysisDataReserveHours,omitempty"`
AllowPorts []types.PortsRange `json:"allowPorts,omitempty"`
HTTPPlugins []HTTPPluginOptions `json:"httpPlugins,omitempty"`
}
func (*ServerConfig) Complete ¶
func (c *ServerConfig) Complete()
type ServerTransportConfig ¶
type ServerTransportConfig struct {
// TCPMux toggles TCP stream multiplexing. This allows multiple requests
// from a client to share a single TCP connection. By default, this value
// is true.
// $HideFromDoc
TCPMux *bool `json:"tcpMux,omitempty"`
// TCPMuxKeepaliveInterval specifies the keep alive interval for TCP stream multiplier.
// If TCPMux is true, heartbeat of application layer is unnecessary because it can only rely on heartbeat in TCPMux.
TCPMuxKeepaliveInterval int64 `json:"tcpMuxKeepaliveInterval,omitempty"`
// TCPKeepAlive specifies the interval between keep-alive probes for an active network connection between frpc and frps.
// If negative, keep-alive probes are disabled.
TCPKeepAlive int64 `json:"tcpKeepalive,omitempty"`
// MaxPoolCount specifies the maximum pool size for each proxy. By default,
// this value is 5.
MaxPoolCount int64 `json:"maxPoolCount,omitempty"`
// HeartBeatTimeout specifies the maximum time to wait for a heartbeat
// before terminating the connection. It is not recommended to change this
// value. By default, this value is 90. Set negative value to disable it.
HeartbeatTimeout int64 `json:"heartbeatTimeout,omitempty"`
// QUIC options.
QUIC QUICOptions `json:"quic,omitempty"`
// TLS specifies TLS settings for the connection from the client.
TLS TLSServerConfig `json:"tls,omitempty"`
}
func (*ServerTransportConfig) Complete ¶
func (c *ServerTransportConfig) Complete()
type Socks5PluginOptions ¶
type Socks5PluginOptions struct {
Type string `json:"type,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
}
func (*Socks5PluginOptions) Complete ¶
func (o *Socks5PluginOptions) Complete()
type StaticFilePluginOptions ¶
type StaticFilePluginOptions struct {
Type string `json:"type,omitempty"`
LocalPath string `json:"localPath,omitempty"`
StripPrefix string `json:"stripPrefix,omitempty"`
HTTPUser string `json:"httpUser,omitempty"`
HTTPPassword string `json:"httpPassword,omitempty"`
}
func (*StaticFilePluginOptions) Complete ¶
func (o *StaticFilePluginOptions) Complete()
type TCPMultiplexerType ¶
type TCPMultiplexerType string
const (
TCPMultiplexerHTTPConnect TCPMultiplexerType = "httpconnect"
)
type TCPMuxProxyConfig ¶
type TCPMuxProxyConfig struct {
ProxyBaseConfig
DomainConfig
HTTPUser string `json:"httpUser,omitempty"`
HTTPPassword string `json:"httpPassword,omitempty"`
RouteByHTTPUser string `json:"routeByHTTPUser,omitempty"`
Multiplexer string `json:"multiplexer,omitempty"`
}
func (*TCPMuxProxyConfig) MarshalToMsg ¶
func (c *TCPMuxProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*TCPMuxProxyConfig) UnmarshalFromMsg ¶
func (c *TCPMuxProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type TCPProxyConfig ¶
type TCPProxyConfig struct {
ProxyBaseConfig
RemotePort int `json:"remotePort,omitempty"`
}
func (*TCPProxyConfig) MarshalToMsg ¶
func (c *TCPProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*TCPProxyConfig) UnmarshalFromMsg ¶
func (c *TCPProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type TLSClientConfig ¶
type TLSClientConfig struct {
// TLSEnable specifies whether or not TLS should be used when communicating
// with the server. If "tls.certFile" and "tls.keyFile" are valid,
// client will load the supplied tls configuration.
// Since v0.50.0, the default value has been changed to true, and tls is enabled by default.
Enable *bool `json:"enable,omitempty"`
// If DisableCustomTLSFirstByte is set to false, frpc will establish a connection with frps using the
// first custom byte when tls is enabled.
// Since v0.50.0, the default value has been changed to true, and the first custom byte is disabled by default.
DisableCustomTLSFirstByte *bool `json:"disableCustomTLSFirstByte,omitempty"`
TLSConfig
}
func (*TLSClientConfig) Complete ¶
func (c *TLSClientConfig) Complete()
type TLSConfig ¶
type TLSConfig struct {
// CertPath specifies the path of the cert file that client will load.
CertFile string `json:"certFile,omitempty"`
// KeyPath specifies the path of the secret key file that client will load.
KeyFile string `json:"keyFile,omitempty"`
// TrustedCaFile specifies the path of the trusted ca file that will load.
TrustedCaFile string `json:"trustedCaFile,omitempty"`
// ServerName specifies the custom server name of tls certificate. By
// default, server name if same to ServerAddr.
ServerName string `json:"serverName,omitempty"`
}
type TLSServerConfig ¶
type TypedClientPluginOptions ¶
type TypedClientPluginOptions struct {
Type string `json:"type"`
ClientPluginOptions
}
func (*TypedClientPluginOptions) MarshalJSON ¶
func (c *TypedClientPluginOptions) MarshalJSON() ([]byte, error)
func (*TypedClientPluginOptions) UnmarshalJSON ¶
func (c *TypedClientPluginOptions) UnmarshalJSON(b []byte) error
type TypedProxyConfig ¶
type TypedProxyConfig struct {
Type string `json:"type"`
ProxyConfigurer
}
func (*TypedProxyConfig) MarshalJSON ¶
func (c *TypedProxyConfig) MarshalJSON() ([]byte, error)
func (*TypedProxyConfig) UnmarshalJSON ¶
func (c *TypedProxyConfig) UnmarshalJSON(b []byte) error
type TypedVisitorConfig ¶
type TypedVisitorConfig struct {
Type string `json:"type"`
VisitorConfigurer
}
func (*TypedVisitorConfig) MarshalJSON ¶
func (c *TypedVisitorConfig) MarshalJSON() ([]byte, error)
func (*TypedVisitorConfig) UnmarshalJSON ¶
func (c *TypedVisitorConfig) UnmarshalJSON(b []byte) error
type UDPProxyConfig ¶
type UDPProxyConfig struct {
ProxyBaseConfig
RemotePort int `json:"remotePort,omitempty"`
}
func (*UDPProxyConfig) MarshalToMsg ¶
func (c *UDPProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*UDPProxyConfig) UnmarshalFromMsg ¶
func (c *UDPProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type UnixDomainSocketPluginOptions ¶
type UnixDomainSocketPluginOptions struct {
Type string `json:"type,omitempty"`
UnixPath string `json:"unixPath,omitempty"`
}
func (*UnixDomainSocketPluginOptions) Complete ¶
func (o *UnixDomainSocketPluginOptions) Complete()
type VisitorBaseConfig ¶
type VisitorBaseConfig struct {
Name string `json:"name"`
Type string `json:"type"`
Transport VisitorTransport `json:"transport,omitempty"`
SecretKey string `json:"secretKey,omitempty"`
// if the server user is not set, it defaults to the current user
ServerUser string `json:"serverUser,omitempty"`
ServerName string `json:"serverName,omitempty"`
BindAddr string `json:"bindAddr,omitempty"`
// BindPort is the port that visitor listens on.
// It can be less than 0, it means don't bind to the port and only receive connections redirected from
// other visitors. (This is not supported for SUDP now)
BindPort int `json:"bindPort,omitempty"`
}
func (*VisitorBaseConfig) Complete ¶
func (c *VisitorBaseConfig) Complete(g *ClientCommonConfig)
func (*VisitorBaseConfig) GetBaseConfig ¶
func (c *VisitorBaseConfig) GetBaseConfig() *VisitorBaseConfig
type VisitorConfigurer ¶
type VisitorConfigurer interface {
Complete(*ClientCommonConfig)
GetBaseConfig() *VisitorBaseConfig
}
func NewVisitorConfigurerByType ¶
func NewVisitorConfigurerByType(t VisitorType) VisitorConfigurer
type VisitorTransport ¶
type VisitorType ¶
type VisitorType string
const ( VisitorTypeSTCP VisitorType = "stcp" VisitorTypeXTCP VisitorType = "xtcp" VisitorTypeSUDP VisitorType = "sudp" )
type WebServerConfig ¶
type WebServerConfig struct {
// This is the network address to bind on for serving the web interface and API.
// By default, this value is "127.0.0.1".
Addr string `json:"addr,omitempty"`
// Port specifies the port for the web server to listen on. If this
// value is 0, the admin server will not be started.
Port int `json:"port,omitempty"`
// User specifies the username that the web server will use for login.
User string `json:"user,omitempty"`
// Password specifies the password that the admin server will use for login.
Password string `json:"password,omitempty"`
// AssetsDir specifies the local directory that the admin server will load
// resources from. If this value is "", assets will be loaded from the
// bundled executable using embed package.
AssetsDir string `json:"assetsDir,omitempty"`
// Enable golang pprof handlers.
PprofEnable bool `json:"pprofEnable,omitempty"`
// Enable TLS if TLSConfig is not nil.
TLS *TLSConfig `json:"tls,omitempty"`
}
func (*WebServerConfig) Complete ¶
func (c *WebServerConfig) Complete()
type XTCPProxyConfig ¶
type XTCPProxyConfig struct {
ProxyBaseConfig
Secretkey string `json:"secretKey,omitempty"`
AllowUsers []string `json:"allowUsers,omitempty"`
}
func (*XTCPProxyConfig) MarshalToMsg ¶
func (c *XTCPProxyConfig) MarshalToMsg(m *msg.NewProxy)
func (*XTCPProxyConfig) UnmarshalFromMsg ¶
func (c *XTCPProxyConfig) UnmarshalFromMsg(m *msg.NewProxy)
type XTCPVisitorConfig ¶
type XTCPVisitorConfig struct {
VisitorBaseConfig
Protocol string `json:"protocol,omitempty"`
KeepTunnelOpen bool `json:"keepTunnelOpen,omitempty"`
MaxRetriesAnHour int `json:"maxRetriesAnHour,omitempty"`
MinRetryInterval int `json:"minRetryInterval,omitempty"`
FallbackTo string `json:"fallbackTo,omitempty"`
FallbackTimeoutMs int `json:"fallbackTimeoutMs,omitempty"`
}
func (*XTCPVisitorConfig) Complete ¶
func (c *XTCPVisitorConfig) Complete(g *ClientCommonConfig)
Click to show internal directories.
Click to hide internal directories.