out

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

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

func (mgr *Manager) AddBackend(data []byte) string

AddBackend - add given backend as NEW backend

func (*Manager) BackendConfig

func (mgr *Manager) BackendConfig(id string) string

BackendConfig returns configuration of given backend

func (*Manager) DeleteBackend

func (mgr *Manager) DeleteBackend(id string) (int, error)

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

func (mgr *Manager) DisableBackend(id string) (int, error)

DisableBackend - disable given backend thus no more NEW connections to this B/E

func (*Manager) EnableBackend

func (mgr *Manager) EnableBackend(id string) (int, error)

EnableBackend - disable given backend thus no more NEW connections to this B/E

func (*Manager) ListBackends

func (mgr *Manager) ListBackends() string

ListBackends - lists all backend as json

func (*Manager) ResetBackend

func (mgr *Manager) ResetBackend(id string) (int, error)

ResetBackend resets the circuit breaker so that subsequent calls are allowed to this backend

func (*Manager) Stop

func (mgr *Manager) Stop()

Stop shuts down all backends, primarily used for test purposes

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL