Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnsupportedProxyProtocolVersion = errors.New("unsupported proxy protocol version") ErrInvalidConfigValue = errors.New("invalid config value") )
Functions ¶
This section is empty.
Types ¶
type Advance ¶
type Advance struct {
IgnoreWrongNamespace bool `yaml:"ignore-wrong-namespace,omitempty" toml:"ignore-wrong-namespace,omitempty" json:"ignore-wrong-namespace,omitempty"`
}
type BackendNamespace ¶
type Config ¶
type Config struct { Proxy ProxyServer `yaml:"proxy,omitempty" toml:"proxy,omitempty" json:"proxy,omitempty"` API API `yaml:"api,omitempty" toml:"api,omitempty" json:"api,omitempty"` Advance Advance `yaml:"advance,omitempty" toml:"advance,omitempty" json:"advance,omitempty"` Workdir string `yaml:"workdir,omitempty" toml:"workdir,omitempty" json:"workdir,omitempty"` Security Security `yaml:"security,omitempty" toml:"security,omitempty" json:"security,omitempty"` Log Log `yaml:"log,omitempty" toml:"log,omitempty" json:"log,omitempty"` }
type FrontendNamespace ¶
type HealthCheck ¶
type HealthCheck struct { Enable bool `yaml:"enable" json:"enable" toml:"enable"` Interval time.Duration `yaml:"interval" json:"interval" toml:"interval"` MaxRetries int `yaml:"max-retries" json:"max-retries" toml:"max-retries"` RetryInterval time.Duration `yaml:"retry-interval" json:"retry-interval" toml:"retry-interval"` DialTimeout time.Duration `yaml:"dial-timeout" json:"dial-timeout" toml:"dial-timeout"` MetricsInterval time.Duration `yaml:"metrics-interval" json:"metrics-interval" toml:"metrics-interval"` MetricsTimeout time.Duration `yaml:"metrics-timeout" json:"metrics-timeout" toml:"metrics-timeout"` }
HealthCheck contains some configurations for health check. Some general configurations of them may be exposed to users in the future. We can use shorter durations to speed up unit tests.
func NewDefaultHealthCheckConfig ¶
func NewDefaultHealthCheckConfig() *HealthCheck
NewDefaultHealthCheckConfig creates a default HealthCheck.
func (*HealthCheck) Check ¶
func (hc *HealthCheck) Check()
type HealthInfo ¶
type HealthInfo struct {
ConfigChecksum uint32 `json:"config_checksum"`
}
type KeepAlive ¶
type KeepAlive struct { Enabled bool `yaml:"enabled,omitempty" toml:"enabled,omitempty" json:"enabled,omitempty"` // Idle, Cnt, and Intvl works only when the connection is idle. User packets will interrupt keep-alive. // If the peer crashes and doesn't send any packets, the connection will be closed within Idle+Cnt*Intvl. Idle time.Duration `yaml:"idle,omitempty" toml:"idle,omitempty" json:"idle,omitempty"` Cnt int `yaml:"cnt,omitempty" toml:"cnt,omitempty" json:"cnt,omitempty"` Intvl time.Duration `yaml:"intvl,omitempty" toml:"intvl,omitempty" json:"intvl,omitempty"` // Timeout is the timeout of waiting ACK. It works for both user packets and keep-alive. // It is suggested to be equal or close to Cnt*Intvl. Timeout time.Duration `yaml:"timeout,omitempty" toml:"timeout,omitempty" json:"timeout,omitempty"` }
func DefaultKeepAlive ¶
func DefaultKeepAlive() (frontend, backendHealthy, backendUnhealthy KeepAlive)
type LogFile ¶
type LogFile struct { Filename string `yaml:"filename,omitempty" toml:"filename,omitempty" json:"filename,omitempty"` MaxSize int `yaml:"max-size,omitempty" toml:"max-size,omitempty" json:"max-size,omitempty"` MaxDays int `yaml:"max-days,omitempty" toml:"max-days,omitempty" json:"max-days,omitempty"` MaxBackups int `yaml:"max-backups,omitempty" toml:"max-backups,omitempty" json:"max-backups,omitempty"` }
type Namespace ¶
type Namespace struct { Namespace string `yaml:"namespace" json:"namespace" toml:"namespace"` Frontend FrontendNamespace `yaml:"frontend" json:"frontend" toml:"frontend"` Backend BackendNamespace `yaml:"backend" json:"backend" toml:"backend"` }
func NewNamespace ¶
type ProxyServer ¶
type ProxyServer struct { Addr string `yaml:"addr,omitempty" toml:"addr,omitempty" json:"addr,omitempty"` AdvertiseAddr string `yaml:"advertise-addr,omitempty" toml:"advertise-addr,omitempty" json:"advertise-addr,omitempty"` PDAddrs string `yaml:"pd-addrs,omitempty" toml:"pd-addrs,omitempty" json:"pd-addrs,omitempty"` ProxyServerOnline `yaml:",inline" toml:",inline" json:",inline"` }
type ProxyServerOnline ¶
type ProxyServerOnline struct { MaxConnections uint64 `yaml:"max-connections,omitempty" toml:"max-connections,omitempty" json:"max-connections,omitempty"` ConnBufferSize int `yaml:"conn-buffer-size,omitempty" toml:"conn-buffer-size,omitempty" json:"conn-buffer-size,omitempty"` FrontendKeepalive KeepAlive `yaml:"frontend-keepalive" toml:"frontend-keepalive" json:"frontend-keepalive"` // BackendHealthyKeepalive applies when the observer treats the backend as healthy. // The config values should be conservative to save CPU and tolerate network fluctuation. BackendHealthyKeepalive KeepAlive `yaml:"backend-healthy-keepalive" toml:"backend-healthy-keepalive" json:"backend-healthy-keepalive"` // BackendUnhealthyKeepalive applies when the observer treats the backend as unhealthy. // The config values can be aggressive because the backend may stop anytime. BackendUnhealthyKeepalive KeepAlive `yaml:"backend-unhealthy-keepalive" toml:"backend-unhealthy-keepalive" json:"backend-unhealthy-keepalive"` ProxyProtocol string `yaml:"proxy-protocol,omitempty" toml:"proxy-protocol,omitempty" json:"proxy-protocol,omitempty"` GracefulWaitBeforeShutdown int `` /* 140-byte string literal not displayed */ GracefulCloseConnTimeout int `` /* 134-byte string literal not displayed */ }
type Security ¶
type Security struct { ServerSQLTLS TLSConfig `yaml:"server-tls,omitempty" toml:"server-tls,omitempty" json:"server-tls,omitempty"` ServerHTTPTLS TLSConfig `yaml:"server-http-tls,omitempty" toml:"server-http-tls,omitempty" json:"server-http-tls,omitempty"` ClusterTLS TLSConfig `yaml:"cluster-tls,omitempty" toml:"cluster-tls,omitempty" json:"cluster-tls,omitempty"` SQLTLS TLSConfig `yaml:"sql-tls,omitempty" toml:"sql-tls,omitempty" json:"sql-tls,omitempty"` RequireBackendTLS bool `yaml:"require-backend-tls,omitempty" toml:"require-backend-tls,omitempty" json:"require-backend-tls,omitempty"` }
type TLSConfig ¶
type TLSConfig struct { Cert string `yaml:"cert,omitempty" toml:"cert,omitempty" json:"cert,omitempty"` Key string `yaml:"key,omitempty" toml:"key,omitempty" json:"key,omitempty"` CA string `yaml:"ca,omitempty" toml:"ca,omitempty" json:"ca,omitempty"` MinTLSVersion string `yaml:"min-tls-version,omitempty" toml:"min-tls-version,omitempty" json:"min-tls-version,omitempty"` AutoCerts bool `yaml:"auto-certs,omitempty" toml:"auto-certs,omitempty" json:"auto-certs,omitempty"` RSAKeySize int `yaml:"rsa-key-size,omitempty" toml:"rsa-key-size,omitempty" json:"rsa-key-size,omitempty"` AutoExpireDuration string `yaml:"autocert-expire-duration,omitempty" toml:"autocert-expire-duration,omitempty" json:"autocert-expire-duration,omitempty"` SkipCA bool `yaml:"skip-ca,omitempty" toml:"skip-ca,omitempty" json:"skip-ca,omitempty"` }
Click to show internal directories.
Click to hide internal directories.