Documentation ¶
Index ¶
- Constants
- func GetRenderedConfFromFile(path string) (out string, err error)
- func LoadAllConfFromIni(prefix string, content string, startProxy map[string]struct{}) (proxyConfs map[string]ProxyConf, visitorConfs map[string]VisitorConf, ...)
- func ParseRangeSection(name string, section ini.Section) (sections map[string]ini.Section, err error)
- func RenderContent(in string) (out string, err error)
- func UnmarshalPluginsFromIni(sections ini.File, cfg *ServerCommonConf)
- type BandwidthQuantity
- func (q *BandwidthQuantity) Bytes() int64
- func (q *BandwidthQuantity) Equal(u *BandwidthQuantity) bool
- func (q *BandwidthQuantity) MarshalJSON() ([]byte, error)
- func (q *BandwidthQuantity) String() string
- func (q *BandwidthQuantity) UnmarshalJSON(b []byte) error
- func (q *BandwidthQuantity) UnmarshalString(s string) error
- type BaseProxyConf
- type BaseVisitorConf
- type BindInfoConf
- type ClientCommonConf
- type DomainConf
- type HealthCheckConf
- type HttpProxyConf
- func (cfg *HttpProxyConf) CheckForCli() (err error)
- func (cfg *HttpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
- func (cfg *HttpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *HttpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *HttpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *HttpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type HttpsProxyConf
- func (cfg *HttpsProxyConf) CheckForCli() (err error)
- func (cfg *HttpsProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
- func (cfg *HttpsProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *HttpsProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *HttpsProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *HttpsProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type LocalSvrConf
- type ProxyConf
- type ServerCommonConf
- type StcpProxyConf
- func (cfg *StcpProxyConf) CheckForCli() (err error)
- func (cfg *StcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
- func (cfg *StcpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *StcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *StcpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *StcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type StcpVisitorConf
- type TcpMuxProxyConf
- func (cfg *TcpMuxProxyConf) CheckForCli() (err error)
- func (cfg *TcpMuxProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
- func (cfg *TcpMuxProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *TcpMuxProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *TcpMuxProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *TcpMuxProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type TcpProxyConf
- func (cfg *TcpProxyConf) CheckForCli() (err error)
- func (cfg *TcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) error
- func (cfg *TcpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *TcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *TcpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *TcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type UdpProxyConf
- func (cfg *UdpProxyConf) CheckForCli() (err error)
- func (cfg *UdpProxyConf) CheckForSvr(serverCfg ServerCommonConf) error
- func (cfg *UdpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *UdpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *UdpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *UdpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type Values
- type VisitorConf
- type XtcpProxyConf
- func (cfg *XtcpProxyConf) CheckForCli() (err error)
- func (cfg *XtcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
- func (cfg *XtcpProxyConf) Compare(cmp ProxyConf) bool
- func (cfg *XtcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
- func (cfg *XtcpProxyConf) UnmarshalFromIni(prefix string, name string, section ini.Section) (err error)
- func (cfg *XtcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
- type XtcpVisitorConf
Constants ¶
const ( MB = 1024 * 1024 KB = 1024 )
Variables ¶
This section is empty.
Functions ¶
func GetRenderedConfFromFile ¶ added in v0.23.0
func LoadAllConfFromIni ¶ added in v0.22.0
func LoadAllConfFromIni(prefix string, content string, startProxy map[string]struct{}) ( proxyConfs map[string]ProxyConf, visitorConfs map[string]VisitorConf, err error)
if len(startProxy) is 0, start all otherwise just start proxies in startProxy map
func ParseRangeSection ¶ added in v0.16.0
func RenderContent ¶ added in v0.23.0
func UnmarshalPluginsFromIni ¶ added in v0.31.0
func UnmarshalPluginsFromIni(sections ini.File, cfg *ServerCommonConf)
Types ¶
type BandwidthQuantity ¶ added in v0.30.0
type BandwidthQuantity struct {
// contains filtered or unexported fields
}
func NewBandwidthQuantity ¶ added in v0.30.0
func NewBandwidthQuantity(s string) (BandwidthQuantity, error)
func (*BandwidthQuantity) Bytes ¶ added in v0.30.0
func (q *BandwidthQuantity) Bytes() int64
func (*BandwidthQuantity) Equal ¶ added in v0.30.0
func (q *BandwidthQuantity) Equal(u *BandwidthQuantity) bool
func (*BandwidthQuantity) MarshalJSON ¶ added in v0.30.0
func (q *BandwidthQuantity) MarshalJSON() ([]byte, error)
func (*BandwidthQuantity) String ¶ added in v0.30.0
func (q *BandwidthQuantity) String() string
func (*BandwidthQuantity) UnmarshalJSON ¶ added in v0.30.0
func (q *BandwidthQuantity) UnmarshalJSON(b []byte) error
func (*BandwidthQuantity) UnmarshalString ¶ added in v0.30.0
func (q *BandwidthQuantity) UnmarshalString(s string) error
type BaseProxyConf ¶
type BaseProxyConf struct { // ProxyName is the name of this proxy. ProxyName string `json:"proxy_name"` // ProxyType specifies the type of this proxy. Valid values include "tcp", // "udp", "http", "https", "stcp", and "xtcp". By default, this value is // "tcp". ProxyType string `json:"proxy_type"` // 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. By default, this value is false. UseEncryption bool `json:"use_encryption"` // UseCompression controls whether or not communication with the server // will be compressed. By default, this value is false. UseCompression bool `json:"use_compression"` // Group specifies which group the proxy is a part of. The server will use // this information to load balance proxies in the same group. If the value // is "", this proxy will not be in a group. By default, this value is "". Group string `json:"group"` // GroupKey specifies a group key, which should be the same among proxies // of the same group. By default, this value is "". GroupKey string `json:"group_key"` // 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:"proxy_protocol_version"` // BandwidthLimit limit the proxy bandwidth // 0 means no limit BandwidthLimit BandwidthQuantity `json:"bandwidth_limit"` // meta info for each proxy Metas map[string]string `json:"metas"` LocalSvrConf HealthCheckConf }
BaseProxyConf provides configuration info that is common to all proxy types.
func (*BaseProxyConf) GetBaseInfo ¶
func (cfg *BaseProxyConf) GetBaseInfo() *BaseProxyConf
func (*BaseProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *BaseProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*BaseProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*BaseProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *BaseProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type BaseVisitorConf ¶ added in v0.22.0
type BaseVisitorConf struct { ProxyName string `json:"proxy_name"` ProxyType string `json:"proxy_type"` UseEncryption bool `json:"use_encryption"` UseCompression bool `json:"use_compression"` Role string `json:"role"` Sk string `json:"sk"` ServerName string `json:"server_name"` BindAddr string `json:"bind_addr"` BindPort int `json:"bind_port"` }
func (*BaseVisitorConf) GetBaseInfo ¶ added in v0.22.0
func (cfg *BaseVisitorConf) GetBaseInfo() *BaseVisitorConf
func (*BaseVisitorConf) UnmarshalFromIni ¶ added in v0.22.0
type BindInfoConf ¶
type BindInfoConf struct {
RemotePort int `json:"remote_port"`
}
Bind info
func (*BindInfoConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *BindInfoConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*BindInfoConf) UnmarshalFromIni ¶ added in v0.17.0
func (*BindInfoConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *BindInfoConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type ClientCommonConf ¶
type ClientCommonConf struct { auth.AuthClientConfig // ServerAddr specifies the address of the server to connect to. By // default, this value is "0.0.0.0". ServerAddr string `json:"server_addr"` // ServerPort specifies the port to connect to the server on. By default, // this value is 7000. ServerPort int `json:"server_port"` // HttpProxy 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. HttpProxy string `json:"http_proxy"` // LogFile specifies a file where logs will be written to. This value will // only be used if LogWay is set appropriately. By default, this value is // "console". LogFile string `json:"log_file"` // LogWay specifies the way logging is managed. Valid values are "console" // or "file". If "console" is used, logs will be printed to stdout. If // "file" is used, logs will be printed to LogFile. By default, this value // is "console". LogWay string `json:"log_way"` // LogLevel specifies the minimum log level. Valid values are "trace", // "debug", "info", "warn", and "error". By default, this value is "info". LogLevel string `json:"log_level"` // LogMaxDays specifies the maximum number of days to store log information // before deletion. This is only used if LogWay == "file". By default, this // value is 0. LogMaxDays int64 `json:"log_max_days"` // DisableLogColor disables log colors when LogWay == "console" when set to // true. By default, this value is false. DisableLogColor bool `json:"disable_log_color"` // AdminAddr specifies the address that the admin server binds to. By // default, this value is "127.0.0.1". AdminAddr string `json:"admin_addr"` // AdminPort specifies the port for the admin server to listen on. If this // value is 0, the admin server will not be started. By default, this value // is 0. AdminPort int `json:"admin_port"` // AdminUser specifies the username that the admin server will use for // login. By default, this value is "admin". AdminUser string `json:"admin_user"` // AdminPwd specifies the password that the admin server will use for // login. By default, this value is "admin". AdminPwd string `json:"admin_pwd"` // 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 statik. By default, this value is "". AssetsDir string `json:"assets_dir"` // PoolCount specifies the number of connections the client will make to // the server in advance. By default, this value is 0. PoolCount int `json:"pool_count"` // 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:"tcp_mux"` // 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}". By default, this value is "". User string `json:"user"` // DnsServer specifies a DNS server address for FRPC to use. If this value // is "", the default DNS will be used. By default, this value is "". DnsServer string `json:"dns_server"` // 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:"login_fail_exit"` // 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 map[string]struct{} `json:"start"` // Protocol specifies the protocol to use when interacting with the server. // Valid values are "tcp", "kcp", and "websocket". By default, this value // is "tcp". Protocol string `json:"protocol"` // TLSEnable specifies whether or not TLS should be used when communicating // with the server. TLSEnable bool `json:"tls_enable"` // 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. HeartBeatInterval int64 `json:"heartbeat_interval"` // 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. HeartBeatTimeout int64 `json:"heartbeat_timeout"` // Client meta info Metas map[string]string `json:"metas"` }
ClientCommonConf contains information for a client service. It is recommended to use GetDefaultClientConf instead of creating this object directly, so that all unspecified fields have reasonable default values.
func GetDefaultClientConf ¶ added in v0.17.0
func GetDefaultClientConf() ClientCommonConf
GetDefaultClientConf returns a client configuration with default values.
func UnmarshalClientConfFromIni ¶ added in v0.17.0
func UnmarshalClientConfFromIni(content string) (cfg ClientCommonConf, err error)
func (*ClientCommonConf) Check ¶ added in v0.17.0
func (cfg *ClientCommonConf) Check() (err error)
type DomainConf ¶
type DomainConf struct { CustomDomains []string `json:"custom_domains"` SubDomain string `json:"sub_domain"` }
Domain info
func (*DomainConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *DomainConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*DomainConf) UnmarshalFromIni ¶ added in v0.17.0
func (*DomainConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *DomainConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type HealthCheckConf ¶ added in v0.22.0
type HealthCheckConf struct { // HealthCheckType specifies what protocol to use for health checking. // Valid values include "tcp", "http", and "". If this value is "", health // checking will not be performed. By default, this value is "". // // 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. HealthCheckType string `json:"health_check_type"` // tcp | http // HealthCheckTimeoutS 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. HealthCheckTimeoutS int `json:"health_check_timeout_s"` // HealthCheckMaxFailed specifies the number of allowed failures before the // proxy is stopped. By default, this value is 1. HealthCheckMaxFailed int `json:"health_check_max_failed"` // HealthCheckIntervalS specifies the time in seconds between health // checks. By default, this value is 10. HealthCheckIntervalS int `json:"health_check_interval_s"` // HealthCheckUrl specifies the address to send health checks to if the // health check type is "http". HealthCheckUrl string `json:"health_check_url"` // HealthCheckAddr specifies the address to connect to if the health check // type is "tcp". HealthCheckAddr string `json:"-"` }
HealthCheckConf configures health checking. This can be useful for load balancing purposes to detect and remove proxies to failing services.
func (*HealthCheckConf) UnmarshalFromIni ¶ added in v0.22.0
type HttpProxyConf ¶
type HttpProxyConf struct { BaseProxyConf DomainConf Locations []string `json:"locations"` HttpUser string `json:"http_user"` HttpPwd string `json:"http_pwd"` HostHeaderRewrite string `json:"host_header_rewrite"` Headers map[string]string `json:"headers"` }
HTTP
func (*HttpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *HttpProxyConf) CheckForCli() (err error)
func (*HttpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *HttpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
func (*HttpProxyConf) Compare ¶ added in v0.13.0
func (cfg *HttpProxyConf) Compare(cmp ProxyConf) bool
func (*HttpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *HttpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*HttpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*HttpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *HttpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type HttpsProxyConf ¶
type HttpsProxyConf struct { BaseProxyConf DomainConf }
HTTPS
func (*HttpsProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *HttpsProxyConf) CheckForCli() (err error)
func (*HttpsProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *HttpsProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
func (*HttpsProxyConf) Compare ¶ added in v0.13.0
func (cfg *HttpsProxyConf) Compare(cmp ProxyConf) bool
func (*HttpsProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *HttpsProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*HttpsProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*HttpsProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *HttpsProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type LocalSvrConf ¶
type LocalSvrConf struct { // LocalIp specifies the IP address or host name to proxy to. LocalIp string `json:"local_ip"` // LocalPort specifies the port to proxy to. LocalPort int `json:"local_port"` // Plugin specifies what plugin should be used for proxying. If this value // is set, the LocalIp and LocalPort values will be ignored. By default, // this value is "". Plugin string `json:"plugin"` // PluginParams specify parameters to be passed to the plugin, if one is // being used. By default, this value is an empty map. PluginParams map[string]string `json:"plugin_params"` }
LocalSvrConf configures what location the client will proxy to, or what plugin will be used.
func (*LocalSvrConf) UnmarshalFromIni ¶ added in v0.17.0
type ProxyConf ¶
type ProxyConf interface { GetBaseInfo() *BaseProxyConf UnmarshalFromMsg(pMsg *msg.NewProxy) UnmarshalFromIni(prefix string, name string, conf ini.Section) error MarshalToMsg(pMsg *msg.NewProxy) CheckForCli() error CheckForSvr(serverCfg ServerCommonConf) error Compare(conf ProxyConf) bool }
func NewConfByType ¶
NewConfByType creates a empty ProxyConf object by proxyType. If proxyType isn't exist, return nil.
func NewProxyConfFromIni ¶ added in v0.17.0
func NewProxyConfFromMsg ¶ added in v0.17.0
func NewProxyConfFromMsg(pMsg *msg.NewProxy, serverCfg ServerCommonConf) (cfg ProxyConf, err error)
type ServerCommonConf ¶
type ServerCommonConf struct { auth.AuthServerConfig // BindAddr specifies the address that the server binds to. By default, // this value is "0.0.0.0". BindAddr string `json:"bind_addr"` // BindPort specifies the port that the server listens on. By default, this // value is 7000. BindPort int `json:"bind_port"` // BindUdpPort specifies the UDP port that the server listens on. If this // value is 0, the server will not listen for UDP connections. By default, // this value is 0 BindUdpPort int `json:"bind_udp_port"` // BindKcpPort specifies the KCP port that the server listens on. If this // value is 0, the server will not listen for KCP connections. By default, // this value is 0. KcpBindPort int `json:"kcp_bind_port"` // ProxyBindAddr specifies the address that the proxy binds to. This value // may be the same as BindAddr. By default, this value is "0.0.0.0". ProxyBindAddr string `json:"proxy_bind_addr"` // 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. By default, this value is 0. VhostHttpPort int `json:"vhost_http_port"` // 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. By default, this value is 0. VhostHttpsPort int `json:"vhost_https_port"` // 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. By default, this value is 0. TcpMuxHttpConnectPort int `json:"tcpmux_httpconnect_port"` // VhostHttpTimeout specifies the response header timeout for the Vhost // HTTP server, in seconds. By default, this value is 60. VhostHttpTimeout int64 `json:"vhost_http_timeout"` // DashboardAddr specifies the address that the dashboard binds to. By // default, this value is "0.0.0.0". DashboardAddr string `json:"dashboard_addr"` // DashboardPort specifies the port that the dashboard listens on. If this // value is 0, the dashboard will not be started. By default, this value is // 0. DashboardPort int `json:"dashboard_port"` // DashboardUser specifies the username that the dashboard will use for // login. By default, this value is "admin". DashboardUser string `json:"dashboard_user"` // DashboardUser specifies the password that the dashboard will use for // login. By default, this value is "admin". DashboardPwd string `json:"dashboard_pwd"` // EnablePrometheus will export prometheus metrics on {dashboard_addr}:{dashboard_port} // in /metrics api. EnablePrometheus bool `json:"enable_prometheus"` // AssetsDir specifies the local directory that the dashboard will load // resources from. If this value is "", assets will be loaded from the // bundled executable using statik. By default, this value is "". AssetsDir string `json:"asserts_dir"` // LogFile specifies a file where logs will be written to. This value will // only be used if LogWay is set appropriately. By default, this value is // "console". LogFile string `json:"log_file"` // LogWay specifies the way logging is managed. Valid values are "console" // or "file". If "console" is used, logs will be printed to stdout. If // "file" is used, logs will be printed to LogFile. By default, this value // is "console". LogWay string `json:"log_way"` // LogLevel specifies the minimum log level. Valid values are "trace", // "debug", "info", "warn", and "error". By default, this value is "info". LogLevel string `json:"log_level"` // LogMaxDays specifies the maximum number of days to store log information // before deletion. This is only used if LogWay == "file". By default, this // value is 0. LogMaxDays int64 `json:"log_max_days"` // DisableLogColor disables log colors when LogWay == "console" when set to // true. By default, this value is false. DisableLogColor bool `json:"disable_log_color"` // DetailedErrorsToClient defines whether to send the specific error (with // debug info) to frpc. By default, this value is true. DetailedErrorsToClient bool `json:"detailed_errors_to_client"` // 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". By default, this // value is "". SubDomainHost string `json:"subdomain_host"` // TcpMux toggles TCP stream multiplexing. This allows multiple requests // from a client to share a single TCP connection. By default, this value // is true. TcpMux bool `json:"tcp_mux"` // Custom404Page specifies a path to a custom 404 page to display. If this // value is "", a default page will be displayed. By default, this value is // "". Custom404Page string `json:"custom_404_page"` // AllowPorts specifies a set of ports that clients are able to proxy to. // If the length of this value is 0, all ports are allowed. By default, // this value is an empty set. AllowPorts map[int]struct{} // MaxPoolCount specifies the maximum pool size for each proxy. By default, // this value is 5. MaxPoolCount int64 `json:"max_pool_count"` // MaxPortsPerClient specifies the maximum number of ports a single client // may proxy to. If this value is 0, no limit will be applied. By default, // this value is 0. MaxPortsPerClient int64 `json:"max_ports_per_client"` // TlsOnly specifies whether to only accept TLS-encrypted connections. By // default, the value is false. TlsOnly bool `json:"tls_only"` // 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. HeartBeatTimeout int64 `json:"heart_beat_timeout"` // UserConnTimeout specifies the maximum time to wait for a work // connection. By default, this value is 10. UserConnTimeout int64 `json:"user_conn_timeout"` // HTTPPlugins specify the server plugins support HTTP protocol. HTTPPlugins map[string]plugin.HTTPPluginOptions `json:"http_plugins"` }
ServerCommonConf contains information for a server service. It is recommended to use GetDefaultServerConf instead of creating this object directly, so that all unspecified fields have reasonable default values.
func GetDefaultServerConf ¶ added in v0.17.0
func GetDefaultServerConf() ServerCommonConf
GetDefaultServerConf returns a server configuration with reasonable defaults.
func UnmarshalServerConfFromIni ¶ added in v0.17.0
func UnmarshalServerConfFromIni(content string) (cfg ServerCommonConf, err error)
UnmarshalServerConfFromIni parses the contents of a server configuration ini file and returns the resulting server configuration.
func (*ServerCommonConf) Check ¶ added in v0.17.0
func (cfg *ServerCommonConf) Check() (err error)
type StcpProxyConf ¶ added in v0.13.0
type StcpProxyConf struct { BaseProxyConf Role string `json:"role"` Sk string `json:"sk"` }
STCP
func (*StcpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *StcpProxyConf) CheckForCli() (err error)
func (*StcpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *StcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
func (*StcpProxyConf) Compare ¶ added in v0.13.0
func (cfg *StcpProxyConf) Compare(cmp ProxyConf) bool
func (*StcpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *StcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*StcpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*StcpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *StcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
Only for role server.
type StcpVisitorConf ¶ added in v0.22.0
type StcpVisitorConf struct {
BaseVisitorConf
}
func (*StcpVisitorConf) Check ¶ added in v0.22.0
func (cfg *StcpVisitorConf) Check() (err error)
func (*StcpVisitorConf) Compare ¶ added in v0.22.0
func (cfg *StcpVisitorConf) Compare(cmp VisitorConf) bool
func (*StcpVisitorConf) UnmarshalFromIni ¶ added in v0.22.0
type TcpMuxProxyConf ¶ added in v0.32.0
type TcpMuxProxyConf struct { BaseProxyConf DomainConf Multiplexer string `json:"multiplexer"` }
TCP Multiplexer
func (*TcpMuxProxyConf) CheckForCli ¶ added in v0.32.0
func (cfg *TcpMuxProxyConf) CheckForCli() (err error)
func (*TcpMuxProxyConf) CheckForSvr ¶ added in v0.32.0
func (cfg *TcpMuxProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
func (*TcpMuxProxyConf) Compare ¶ added in v0.32.0
func (cfg *TcpMuxProxyConf) Compare(cmp ProxyConf) bool
func (*TcpMuxProxyConf) MarshalToMsg ¶ added in v0.32.0
func (cfg *TcpMuxProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*TcpMuxProxyConf) UnmarshalFromIni ¶ added in v0.32.0
func (*TcpMuxProxyConf) UnmarshalFromMsg ¶ added in v0.32.0
func (cfg *TcpMuxProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type TcpProxyConf ¶
type TcpProxyConf struct { BaseProxyConf BindInfoConf }
TCP
func (*TcpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *TcpProxyConf) CheckForCli() (err error)
func (*TcpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *TcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) error
func (*TcpProxyConf) Compare ¶ added in v0.13.0
func (cfg *TcpProxyConf) Compare(cmp ProxyConf) bool
func (*TcpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *TcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*TcpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*TcpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *TcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type UdpProxyConf ¶
type UdpProxyConf struct { BaseProxyConf BindInfoConf }
UDP
func (*UdpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *UdpProxyConf) CheckForCli() (err error)
func (*UdpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *UdpProxyConf) CheckForSvr(serverCfg ServerCommonConf) error
func (*UdpProxyConf) Compare ¶ added in v0.13.0
func (cfg *UdpProxyConf) Compare(cmp ProxyConf) bool
func (*UdpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *UdpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*UdpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*UdpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *UdpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
type VisitorConf ¶ added in v0.22.0
type VisitorConf interface { GetBaseInfo() *BaseVisitorConf Compare(cmp VisitorConf) bool UnmarshalFromIni(prefix string, name string, section ini.Section) error Check() error }
func NewVisitorConfByType ¶ added in v0.22.0
func NewVisitorConfByType(cfgType string) VisitorConf
func NewVisitorConfFromIni ¶ added in v0.22.0
type XtcpProxyConf ¶ added in v0.14.0
type XtcpProxyConf struct { BaseProxyConf Role string `json:"role"` Sk string `json:"sk"` }
XTCP
func (*XtcpProxyConf) CheckForCli ¶ added in v0.17.0
func (cfg *XtcpProxyConf) CheckForCli() (err error)
func (*XtcpProxyConf) CheckForSvr ¶ added in v0.17.0
func (cfg *XtcpProxyConf) CheckForSvr(serverCfg ServerCommonConf) (err error)
func (*XtcpProxyConf) Compare ¶ added in v0.14.0
func (cfg *XtcpProxyConf) Compare(cmp ProxyConf) bool
func (*XtcpProxyConf) MarshalToMsg ¶ added in v0.17.0
func (cfg *XtcpProxyConf) MarshalToMsg(pMsg *msg.NewProxy)
func (*XtcpProxyConf) UnmarshalFromIni ¶ added in v0.17.0
func (*XtcpProxyConf) UnmarshalFromMsg ¶ added in v0.17.0
func (cfg *XtcpProxyConf) UnmarshalFromMsg(pMsg *msg.NewProxy)
Only for role server.
type XtcpVisitorConf ¶ added in v0.22.0
type XtcpVisitorConf struct {
BaseVisitorConf
}
func (*XtcpVisitorConf) Check ¶ added in v0.22.0
func (cfg *XtcpVisitorConf) Check() (err error)
func (*XtcpVisitorConf) Compare ¶ added in v0.22.0
func (cfg *XtcpVisitorConf) Compare(cmp VisitorConf) bool