Documentation
¶
Index ¶
- Constants
- func ClientCommonToV1(c *ClientCommon) (r v1.ClientCommonConfig)
- func Expiry(configPath string, del AutoDelete) (time.Duration, error)
- func UnmarshalAppConf(path string, dst *App) (lang *string, err error)
- type App
- type AutoDelete
- type BaseProxyConf
- type ClientAuth
- type ClientCommon
- type ClientConfig
- func (conf *ClientConfig) AddProxy(proxy *Proxy)
- func (conf *ClientConfig) AutoStart() bool
- func (conf *ClientConfig) Complete(read bool)
- func (conf *ClientConfig) Copy(all bool) *ClientConfig
- func (conf *ClientConfig) CountStart() int
- func (conf *ClientConfig) DeleteProxy(index int)
- func (conf *ClientConfig) Ext() string
- func (conf *ClientConfig) Name() string
- func (conf *ClientConfig) Save(path string) error
- type ClientConfigV1
- type DefaultValue
- type HealthCheckConf
- type Mgr
- type PluginParams
- type Proxy
- type ProxyMgr
- type RangePort
- type TypedProxyConfig
- type TypedVisitorConfig
Constants ¶
const ( DefaultAppFile = "app.json" LangFile = "lang.config" )
Variables ¶
This section is empty.
Functions ¶
func ClientCommonToV1 ¶ added in v1.16.0
func ClientCommonToV1(c *ClientCommon) (r v1.ClientCommonConfig)
Types ¶
type App ¶ added in v1.12.0
type AutoDelete ¶ added in v1.13.0
type AutoDelete struct {
// DeleteMethod specifies what delete method to use to delete the config.
// If "absolute" is specified, the expiry date is set in config. If "relative" is specified, the expiry date
// is calculated by adding the days to the file modification time. If it's empty, the config has no expiry date.
DeleteMethod string `ini:"frpmgr_delete_method,omitempty" json:"method,omitempty"`
// DeleteAfterDays is the number of days a config will be kept, after which it may be stopped and deleted.
DeleteAfterDays int64 `ini:"frpmgr_delete_after_days,omitempty" relative:"true" json:"afterDays,omitempty"`
// DeleteAfterDate is the last date the config will be valid, after which it may be stopped and deleted.
DeleteAfterDate time.Time `ini:"frpmgr_delete_after_date,omitempty" absolute:"true" json:"afterDate,omitempty"`
}
func (AutoDelete) Complete ¶ added in v1.13.0
func (ad AutoDelete) Complete() AutoDelete
type BaseProxyConf ¶
type BaseProxyConf struct {
// Name is the name of this proxy.
Name string `ini:"-"`
// Type specifies the type of this. Valid values include tcp, udp,
// xtcp, stcp, sudp, http, https, tcpmux. By default, this value is "tcp".
Type string `ini:"type,omitempty"`
// UseEncryption controls whether 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 `ini:"use_encryption,omitempty"`
// UseCompression controls whether communication with the server
// will be compressed. By default, this value is false.
UseCompression bool `ini:"use_compression,omitempty"`
// 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 will not be in a group. By default, this value is "".
Group string `ini:"group,omitempty"`
// GroupKey specifies a group key, which should be the same among proxies
// of the same group. By default, this value is "".
GroupKey string `ini:"group_key,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 `ini:"proxy_protocol_version,omitempty"`
// BandwidthLimit limits the bandwidth.
// 0 means no limit.
BandwidthLimit string `ini:"bandwidth_limit,omitempty"`
BandwidthLimitMode string `ini:"bandwidth_limit_mode,omitempty"`
// LocalIP specifies the IP address or host name.
LocalIP string `ini:"local_ip,omitempty"`
// LocalPort specifies the port.
LocalPort string `ini:"local_port,omitempty"`
// Plugin specifies what plugin should be used for ng. If this value
// is set, the LocalIp and LocalPort values will be ignored. By default,
// this value is "".
Plugin string `ini:"plugin,omitempty"`
// PluginParams specify parameters to be passed to the plugin, if one is
// being used.
PluginParams `ini:",extends"`
// HealthCheckType specifies what protocol to use for health checking.
HealthCheckType string `ini:"health_check_type,omitempty"` // tcp | http
// Health checking parameters.
HealthCheckConf `ini:",extends"`
// Meta info for each proxy
Metas map[string]string `ini:"-"`
// Annotations for each proxy
Annotations map[string]string `ini:"-"`
// Disabled defines whether to start the proxy.
Disabled bool `ini:"-"`
}
BaseProxyConf provides configuration info that is common to all types.
type ClientAuth ¶
type ClientAuth struct {
AuthMethod string `ini:"authentication_method,omitempty"`
AuthenticateHeartBeats bool `ini:"authenticate_heartbeats,omitempty" token:"true" oidc:"true"`
AuthenticateNewWorkConns bool `ini:"authenticate_new_work_conns,omitempty" token:"true" oidc:"true"`
Token string `ini:"token,omitempty" token:"true"`
TokenSource string `ini:"-" token:"true" oidc:"true"`
TokenSourceFile string `ini:"-" token:"true" oidc:"true"`
OIDCClientId string `ini:"oidc_client_id,omitempty" oidc:"true"`
OIDCClientSecret string `ini:"oidc_client_secret,omitempty" oidc:"true"`
OIDCAudience string `ini:"oidc_audience,omitempty" oidc:"true"`
OIDCScope string `ini:"oidc_scope,omitempty" oidc:"true"`
OIDCTokenEndpoint string `ini:"oidc_token_endpoint_url,omitempty" oidc:"true"`
OIDCAdditionalEndpointParams map[string]string `ini:"-" oidc:"true"`
OIDCTrustedCaFile string `ini:"-" oidc:"true"`
OIDCInsecureSkipVerify bool `ini:"-" oidc:"true"`
OIDCProxyURL string `ini:"-" oidc:"true"`
}
func (ClientAuth) Complete ¶ added in v1.13.0
func (ca ClientAuth) Complete() ClientAuth
type ClientCommon ¶
type ClientCommon struct {
v1.APIMetadata `ini:"-"`
ClientAuth `ini:",extends"`
ServerAddress string `ini:"server_addr,omitempty"`
ServerPort int `ini:"server_port,omitempty"`
NatHoleSTUNServer string `ini:"nat_hole_stun_server,omitempty"`
DialServerTimeout int64 `ini:"dial_server_timeout,omitempty"`
DialServerKeepAlive int64 `ini:"dial_server_keepalive,omitempty"`
ConnectServerLocalIP string `ini:"connect_server_local_ip,omitempty"`
HTTPProxy string `ini:"http_proxy,omitempty"`
LogFile string `ini:"log_file,omitempty"`
LogLevel string `ini:"log_level,omitempty"`
LogMaxDays int64 `ini:"log_max_days,omitempty"`
AdminAddr string `ini:"admin_addr,omitempty"`
AdminPort int `ini:"admin_port,omitempty"`
AdminUser string `ini:"admin_user,omitempty"`
AdminPwd string `ini:"admin_pwd,omitempty"`
AdminTLS v1.TLSConfig `ini:"-"`
AssetsDir string `ini:"assets_dir,omitempty"`
PoolCount int `ini:"pool_count,omitempty"`
DNSServer string `ini:"dns_server,omitempty"`
Protocol string `ini:"protocol,omitempty"`
QUICKeepalivePeriod int `ini:"quic_keepalive_period,omitempty"`
QUICMaxIdleTimeout int `ini:"quic_max_idle_timeout,omitempty"`
QUICMaxIncomingStreams int `ini:"quic_max_incoming_streams,omitempty"`
LoginFailExit bool `ini:"login_fail_exit"`
User string `ini:"user,omitempty"`
ClientID string `ini:"-"`
HeartbeatInterval int64 `ini:"heartbeat_interval,omitempty"`
HeartbeatTimeout int64 `ini:"heartbeat_timeout,omitempty"`
TCPMux bool `ini:"tcp_mux"`
TCPMuxKeepaliveInterval int64 `ini:"tcp_mux_keepalive_interval,omitempty"`
TLSEnable bool `ini:"tls_enable"`
TLSCertFile string `ini:"tls_cert_file,omitempty"`
TLSKeyFile string `ini:"tls_key_file,omitempty"`
TLSTrustedCaFile string `ini:"tls_trusted_ca_file,omitempty"`
TLSServerName string `ini:"tls_server_name,omitempty"`
UDPPacketSize int64 `ini:"udp_packet_size,omitempty"`
Start []string `ini:"start,omitempty"`
PprofEnable bool `ini:"pprof_enable,omitempty"`
DisableCustomTLSFirstByte bool `ini:"disable_custom_tls_first_byte"`
Store v1.StoreConfig `ini:"-"`
// Name of this config.
Name string `ini:"frpmgr_name"`
// ManualStart defines whether to start the config on system boot.
ManualStart bool `ini:"frpmgr_manual_start,omitempty"`
// AutoDelete is a mechanism for temporary use.
// The config will be stopped and deleted at some point.
AutoDelete `ini:",extends"`
// Client meta info
Metas map[string]string `ini:"-"`
// Config file format
LegacyFormat bool `ini:"-"`
}
func ClientCommonFromV1 ¶ added in v1.16.0
func ClientCommonFromV1(c *v1.ClientCommonConfig) (r ClientCommon)
type ClientConfig ¶
type ClientConfig struct {
ClientCommon
Proxies []*Proxy
}
func NewDefaultClientConfig ¶
func NewDefaultClientConfig() *ClientConfig
func UnmarshalClientConf ¶ added in v1.16.0
func UnmarshalClientConf(source interface{}) (*ClientConfig, error)
func UnmarshalClientConfFromIni ¶
func UnmarshalClientConfFromIni(source interface{}) (*ClientConfig, error)
func (*ClientConfig) AddProxy ¶ added in v1.23.0
func (conf *ClientConfig) AddProxy(proxy *Proxy)
func (*ClientConfig) AutoStart ¶
func (conf *ClientConfig) AutoStart() bool
AutoStart indicates whether this config should be started at boot.
func (*ClientConfig) Complete ¶
func (conf *ClientConfig) Complete(read bool)
Complete prunes and completes this config. When "read" is true, the config should be completed for a file loaded from source. Otherwise, it should be completed for file written to disk.
func (*ClientConfig) Copy ¶ added in v1.9.0
func (conf *ClientConfig) Copy(all bool) *ClientConfig
Copy creates a new copy of this config.
func (*ClientConfig) CountStart ¶ added in v1.7.1
func (conf *ClientConfig) CountStart() int
CountStart returns the number of enabled proxies.
func (*ClientConfig) DeleteProxy ¶ added in v1.23.0
func (conf *ClientConfig) DeleteProxy(index int)
func (*ClientConfig) Ext ¶ added in v1.16.1
func (conf *ClientConfig) Ext() string
Ext is the file extension of this config.
func (*ClientConfig) Name ¶ added in v1.20.0
func (conf *ClientConfig) Name() string
Name of this config.
func (*ClientConfig) Save ¶
func (conf *ClientConfig) Save(path string) error
type ClientConfigV1 ¶ added in v1.16.0
type ClientConfigV1 struct {
v1.ClientCommonConfig
Proxies []TypedProxyConfig `json:"proxies,omitempty"`
Visitors []TypedVisitorConfig `json:"visitors,omitempty"`
Mgr Mgr `json:"frpmgr,omitempty"`
}
func NewDefaultClientConfigV1 ¶ added in v1.16.0
func NewDefaultClientConfigV1() ClientConfigV1
type DefaultValue ¶ added in v1.16.0
type DefaultValue struct {
Protocol string `json:"protocol,omitempty"`
User string `json:"user,omitempty"`
LogLevel string `json:"logLevel"`
LogMaxDays int64 `json:"logMaxDays"`
DNSServer string `json:"dnsServer,omitempty"`
NatHoleSTUNServer string `json:"natHoleStunServer,omitempty"`
ConnectServerLocalIP string `json:"connectServerLocalIP,omitempty"`
TCPMux bool `json:"tcpMux"`
TLSEnable bool `json:"tls"`
ManualStart bool `json:"manualStart,omitempty"`
LegacyFormat bool `json:"legacyFormat,omitempty"`
}
func (*DefaultValue) AsClientConfig ¶ added in v1.16.0
func (dv *DefaultValue) AsClientConfig() ClientCommon
type HealthCheckConf ¶
type HealthCheckConf struct {
// 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 `ini:"health_check_timeout_s,omitempty" tcp:"true" http:"true"`
// HealthCheckMaxFailed specifies the number of allowed failures before the
// is stopped. By default, this value is 1.
HealthCheckMaxFailed int `ini:"health_check_max_failed,omitempty" tcp:"true" http:"true"`
// HealthCheckIntervalS specifies the time in seconds between health
// checks. By default, this value is 10.
HealthCheckIntervalS int `ini:"health_check_interval_s,omitempty" tcp:"true" http:"true"`
// HealthCheckURL specifies the address to send health checks to if the
// health check type is "http".
HealthCheckURL string `ini:"health_check_url,omitempty" http:"true"`
// HealthCheckHTTPHeaders specifies the headers to send with the http request.
HealthCheckHTTPHeaders map[string]string `ini:"-" http:"true"`
}
HealthCheckConf configures health checking. This can be useful for load balancing purposes to detect and remove proxies to failing services.
type Mgr ¶ added in v1.16.0
type Mgr struct {
Name string `json:"name,omitempty"`
ManualStart bool `json:"manualStart,omitempty"`
AutoDelete AutoDelete `json:"autoDelete,omitempty"`
}
type PluginParams ¶
type PluginParams struct {
PluginLocalAddr string `ini:"plugin_local_addr,omitempty" http2https:"true" http2http:"true" https2https:"true" https2http:"true" tls2raw:"true"`
PluginCrtPath string `ini:"plugin_crt_path,omitempty" https2https:"true" https2http:"true" tls2raw:"true"`
PluginKeyPath string `ini:"plugin_key_path,omitempty" https2https:"true" https2http:"true" tls2raw:"true"`
PluginHostHeaderRewrite string `ini:"plugin_host_header_rewrite,omitempty" http2https:"true" http2http:"true" https2https:"true" https2http:"true"`
PluginHttpUser string `ini:"plugin_http_user,omitempty" http_proxy:"true" static_file:"true"`
PluginHttpPasswd string `ini:"plugin_http_passwd,omitempty" http_proxy:"true" static_file:"true"`
PluginUser string `ini:"plugin_user,omitempty" socks5:"true"`
PluginPasswd string `ini:"plugin_passwd,omitempty" socks5:"true"`
PluginLocalPath string `ini:"plugin_local_path,omitempty" static_file:"true"`
PluginStripPrefix string `ini:"plugin_strip_prefix,omitempty" static_file:"true"`
PluginUnixPath string `ini:"plugin_unix_path,omitempty" unix_domain_socket:"true"`
PluginHeaders map[string]string `ini:"-" http2https:"true" http2http:"true" https2https:"true" https2http:"true"`
PluginEnableHTTP2 bool `ini:"-" https2https:"true" https2http:"true"`
}
type Proxy ¶
type Proxy struct {
BaseProxyConf `ini:",extends"`
RemotePort string `ini:"remote_port,omitempty" tcp:"true" udp:"true"`
Role string `ini:"role,omitempty" stcp:"true" xtcp:"true" sudp:"true" visitor:"*"`
SK string `ini:"sk,omitempty" stcp:"true" xtcp:"true" sudp:"true" visitor:"*"`
AllowUsers string `ini:"allow_users,omitempty" stcp:"true" xtcp:"true" sudp:"true"`
ServerUser string `ini:"server_user,omitempty" visitor:"*"`
ServerName string `ini:"server_name,omitempty" visitor:"*"`
BindAddr string `ini:"bind_addr,omitempty" visitor:"*"`
BindPort int `ini:"bind_port,omitempty" visitor:"*"`
CustomDomains string `ini:"custom_domains,omitempty" http:"true" https:"true" tcpmux:"true"`
SubDomain string `ini:"subdomain,omitempty" http:"true" https:"true" tcpmux:"true"`
Locations string `ini:"locations,omitempty" http:"true"`
HTTPUser string `ini:"http_user,omitempty" http:"true" tcpmux:"true"`
HTTPPwd string `ini:"http_pwd,omitempty" http:"true" tcpmux:"true"`
HostHeaderRewrite string `ini:"host_header_rewrite,omitempty" http:"true"`
Headers map[string]string `ini:"-" http:"true"`
ResponseHeaders map[string]string `ini:"-" http:"true"`
Multiplexer string `ini:"multiplexer,omitempty" tcpmux:"true"`
RouteByHTTPUser string `ini:"route_by_http_user,omitempty" http:"true" tcpmux:"true"`
// "kcp" or "quic"
Protocol string `ini:"protocol,omitempty" visitor:"xtcp"`
KeepTunnelOpen bool `ini:"keep_tunnel_open,omitempty" visitor:"xtcp"`
MaxRetriesAnHour int `ini:"max_retries_an_hour,omitempty" visitor:"xtcp"`
MinRetryInterval int `ini:"min_retry_interval,omitempty" visitor:"xtcp"`
FallbackTo string `ini:"fallback_to,omitempty" visitor:"xtcp"`
FallbackTimeoutMs int `ini:"fallback_timeout_ms,omitempty" visitor:"xtcp"`
DisableAssistedAddrs bool `ini:"-" xtcp:"true" visitor:"xtcp"`
}
func ClientProxyFromV1 ¶ added in v1.16.0
func ClientProxyFromV1(pxyCfg TypedProxyConfig) *Proxy
func ClientVisitorFromV1 ¶ added in v1.16.0
func ClientVisitorFromV1(visitorCfg TypedVisitorConfig) *Proxy
func NewDefaultProxyConfig ¶ added in v1.8.0
func NewProxyFromIni ¶ added in v1.8.0
NewProxyFromIni creates a proxy object from ini section
func UnmarshalProxyFromIni ¶ added in v1.8.0
UnmarshalProxyFromIni finds a single proxy section and unmarshals it from ini source.
func (*Proxy) Complete ¶ added in v1.14.0
func (p *Proxy) Complete()
Complete removes redundant parameters base on the proxy type.
type TypedProxyConfig ¶ added in v1.16.0
type TypedProxyConfig struct {
v1.TypedProxyConfig
Mgr ProxyMgr `json:"frpmgr,omitempty"`
}
func ClientProxyToV1 ¶ added in v1.16.0
func ClientProxyToV1(p *Proxy) ([]TypedProxyConfig, error)
func (*TypedProxyConfig) UnmarshalJSON ¶ added in v1.16.0
func (c *TypedProxyConfig) UnmarshalJSON(b []byte) error
type TypedVisitorConfig ¶ added in v1.18.0
type TypedVisitorConfig struct {
v1.TypedVisitorConfig
Mgr ProxyMgr `json:"frpmgr,omitempty"`
}
func ClientVisitorToV1 ¶ added in v1.16.0
func ClientVisitorToV1(p *Proxy) TypedVisitorConfig
func (*TypedVisitorConfig) UnmarshalJSON ¶ added in v1.18.0
func (c *TypedVisitorConfig) UnmarshalJSON(b []byte) error