Documentation ¶
Index ¶
- type BackendConfig
- type Manager
- func (mgr *Manager) AddBackend(data []byte) string
- func (mgr *Manager) BackendConfig(id string) string
- func (mgr *Manager) DeleteBackend(id string) (int, error)
- func (mgr *Manager) DialUpstream(dialContext *common.BackendDialContext) (common.BackendConnection, error)
- func (mgr *Manager) DisableBackend(id string) (int, error)
- func (mgr *Manager) EnableBackend(id string) (int, error)
- func (mgr *Manager) ListBackends() string
- func (mgr *Manager) ResetBackend(id string) (int, error)
- func (mgr *Manager) Stop()
- type UpstreamConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackendConfig ¶
type BackendConfig struct { URL string `yaml:"url"` ID string `yaml:"id"` PingTime time.Duration `yaml:"ping-time"` ReadBufferSize int `yaml:"read-buffer-size"` WriteBufferSize int `yaml:"write-buffer-size"` BreakerThreshold int `yaml:"breaker-threshold"` HandshakeTimeout time.Duration `yaml:"handshake-timeout"` PassHeaders []string `yaml:"pass-headers"` AbnormalCloseCodes []int `yaml:"abnormal-close-codes"` }
BackendConfig - Single backend server configuration
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is a pool that manages all available backends
func NewManager ¶
func NewManager(config *UpstreamConfig) (*Manager, error)
NewManager create a new initialized backend Manager
func (*Manager) AddBackend ¶
AddBackend - add given backend as NEW backend
func (*Manager) BackendConfig ¶
BackendConfig returns configuration of given backend
func (*Manager) DeleteBackend ¶
DeleteBackend - delete this backend and terminate all connections to this B/E
func (*Manager) DialUpstream ¶
func (mgr *Manager) DialUpstream(dialContext *common.BackendDialContext) (common.BackendConnection, error)
DialUpstream - Creates connection to an backend server and returns the object
func (*Manager) DisableBackend ¶
DisableBackend - disable given backend thus no more NEW connections to this B/E
func (*Manager) EnableBackend ¶
EnableBackend - disable given backend thus no more NEW connections to this B/E
func (*Manager) ListBackends ¶
ListBackends - lists all backend as json
func (*Manager) ResetBackend ¶
ResetBackend resets the circuit breaker so that subsequent calls are allowed to this backend
type UpstreamConfig ¶
type UpstreamConfig struct { URLs []string `env:"BE_URLS" env-description:"Backend URL endpoints, comma separated, APPENDS to existing backends"` IDs []string `env:"BE_URL_IDS" env-description:"Respective backend URL IDs, comma separated"` PingTime time.Duration `env:"BE_PING_TIME" env-description:"Backend webSocket ping time"` ReadBufferSize int `env:"BE_RB_SIZE" env-description:"Backend webSocket ReadBuffer size"` WriteBufferSize int `env:"BE_WB_SIZE" env-description:"Backend webSocket WriteBuffer size"` BreakerThreshold int `env:"BE_BREAKER_THRESHOLD" env-description:"Backend circuit breaker threshold"` HandshakeTimeout time.Duration `env:"BE_HANDSHAKE_TIMEOUT" env-description:"Backend webSocket handshake timeout"` PassHeaders []string `env:"BE_PASS_HEADERS" env-description:"Headers to pass from B/E to F/E, comma separated"` AbnormalCloseCodes []int `` /* 126-byte string literal not displayed */ Backends []*BackendConfig `yaml:"backends"` // contains filtered or unexported fields }
UpstreamConfig defines backend servers configuration
Most of these are environment ONLY having no counterparts into yml. yml parameters are in nested BackendConfig. IF any of these env variables are provided then these will OVERWRITE any value of those in BackendConfig struct from yml configuration for each of the backend.