Documentation ¶
Index ¶
- Constants
- func Load(conf *config.Config) (*healthchecks.Healthchecks, error)
- func LoadConf(file string) (*config.Config, error)
- func NetnsServer(socket string)
- type Balancer
- type Checker
- type Counter
- type Director
- type Healthchecks
- type IP4
- type L4
- type Probes
- type Scheduler
- type Service
- type Target
- type VC5
- func (v *VC5) BlockList(list [1048576]bool)
- func (v *VC5) Checker() monitor.Checker
- func (v *VC5) Close()
- func (v *VC5) Configure(h *healthchecks.Healthchecks)
- func (v *VC5) DEFCON(d uint8) uint8
- func (v *VC5) FlowQueue() []byte
- func (v *VC5) NoBlockList()
- func (v *VC5) Prefixes() [1048576]uint64
- func (v *VC5) Start(address string, hc *healthchecks.Healthchecks) error
- func (v *VC5) Stats() (kernel.Counter, map[kernel.Target]kernel.Counter)
- func (v *VC5) Status() healthchecks.Healthchecks
- func (v *VC5) StoreFlow(fs []byte)
Constants ¶
const MH_PORT = types.MH_PORT
const TCP = healthchecks.TCP
const UDP = healthchecks.UDP
const WLC = types.WLC
const WRR = types.WRR
Variables ¶
This section is empty.
Functions ¶
func Load ¶ added in v0.1.4
func Load(conf *config.Config) (*healthchecks.Healthchecks, error)
****************************************************************************** Generate a Healthchecks object from a Config
func LoadConf ¶
Unmarshal a Config object from a JSON file. An internal LoadBalancer Healthchecks object can be generated from this
func NetnsServer ¶
func NetnsServer(socket string)
Start a healthcheck server which will listen for requests via the UNIX domain socket. This should be called by the executable spawned from the LoadBalancer.NetnsCommand[] setting, which will be run a different network namespace.
Types ¶
type Balancer ¶ added in v0.1.20
type Balancer interface { Start(string, *healthchecks.Healthchecks) error Configure(*healthchecks.Healthchecks) Checker() monitor.Checker Status() healthchecks.Healthchecks Stats() (kernel.Counter, map[kernel.Target]kernel.Counter) Close() }
type Director ¶ added in v0.1.20
type Director struct { Logger types.Logger Balancer Balancer // contains filtered or unexported fields }
func (*Director) Close ¶ added in v0.1.20
func (lb *Director) Close()
Cease all load-balancing functionality. Once called the LoadBalancer object must not be used.
func (*Director) Start ¶ added in v0.1.20
func (lb *Director) Start(ip string, hc *healthchecks.Healthchecks) error
If all of the backend servers are in VLANs specified in the healthchecks configuration then address will not be used. func (lb *Director) Start(ip string, hc *healthchecks.Healthchecks, balancer Balancer) error {
func (*Director) Stats ¶ added in v0.1.20
Returns a map of active service statistics. A counter is returned for each four-tuple of virtual IP, backend IP, layer four protocol and port number (Target).
func (*Director) Status ¶ added in v0.1.20
func (lb *Director) Status() healthchecks.Healthchecks
Status returns a Healthchecks object which is a copy of the current load-balancer configuration with backend server MAC addresses and healthcheck probe results, service and virtual IP status filled in.
func (*Director) Update ¶ added in v0.1.20
func (lb *Director) Update(hc *healthchecks.Healthchecks)
Replace the LoadBalancer configuration with hc. New VIPs, services and backend server will be added in a non-disruptive manner, existing elements will be unchanged and obsolete ones removed.
type Healthchecks ¶ added in v0.1.20
type Healthchecks = healthchecks.Healthchecks
type Service ¶ added in v0.1.20
type Service = healthchecks.Serv
type VC5 ¶
type VC5 struct { // DEFCON level at which to start the load-balancer; will default // to normal operation if left at 0. ReadinessLevel uint8 // Use native driver mode when attaching interfaces in XDP. Native bool // Treat VLANs as seperate interfaces, rather than tagging // ethernet frames. Not recommended for production - you should // use tagged VLANs wherever possible. MultiNIC bool // When true, the shared flow map will be used to check for // untracked flows which may hae migrated from other server in a // cluster. This mitigates agains flows being dropped because the // pool of beackend servers has changed since the flow began. Distributed bool // UNIX domain socket to use for initiating backend // healthchecks. The healtchecks are sources from a virtual // interface in a seperate network namespace - this socket is used // to communicate with the process running there. Socket string // Command to run to create the isolated healthcheck process. This // can be used to pass the UNIX domain socket to an executable // which will run NetnsServer(). NetnsCommand []string // Array of one or more physical interfaces (eg.: eth0, enp130s0f0) to load with // the XDP/eBPF load-balancing logic. Interfaces []string // In the case of a bonded network device, the physical interfaces // (eg.: enp130s0f0, enp130s0f1) sould be declared in the // Interfaces field, and the name of the virtual device (bond0) // should be specified here. This will ensure that outgoing // healthcheck probes are set out from an active member of the link aggregation group. EgressInterface string // Logging interface to use for event reporting. Logger types.Logger // contains filtered or unexported fields }
A VC5 defines the network parameters for operation of the load-balancing logic, such as what interfaces and driver modes to use.
func (*VC5) BlockList ¶ added in v0.1.20
Submit an array of bool elements, each corresponding to a /20 IPv4 prefix. A true value will cause packets with a source address withing the prefix to be dropped.
func (*VC5) Close ¶
func (v *VC5) Close()
Cease all load-balancing functionality. Once called the VC5 object must not be used.
func (*VC5) Configure ¶ added in v0.1.20
func (v *VC5) Configure(h *healthchecks.Healthchecks)
func (*VC5) FlowQueue ¶ added in v0.1.20
Poll the flow queue for state records which can be shared with other nodes in a cluster to preserve connections when failing over between nodes.
func (*VC5) NoBlockList ¶ added in v0.1.20
func (v *VC5) NoBlockList()
func (*VC5) Prefixes ¶ added in v0.1.20
Returns an array of packet counters. Each counter is the total number of packets received from sequential /20 subnets (4096 IP addresses per subnet); element 0 corresponds to 0.0.0.0/20, element 42929 corresponds to 10.123.16.0/20. This can be used to build a profile of client source addresses for reporting/visualisation or DDoS mitigation purposes. This is an expensive operation (may take over a second to complete) so you should rate-limit how often is it called.
func (*VC5) Start ¶ added in v0.1.20
func (v *VC5) Start(address string, hc *healthchecks.Healthchecks) error
func (*VC5) Stats ¶
Returns a map of active service statistics. A counter is returned for each four-tuple of virtual IP, backend IP, layer four protocol and port number (Target).
func (*VC5) Status ¶
func (v *VC5) Status() healthchecks.Healthchecks
Status returns a Healthchecks object which is a copy of the current load-balancer configuration with backend server MAC addresses and healthcheck probe results, service and virtual IP status filled in.
Directories ¶
Path | Synopsis |
---|---|
This package provides structures representing a load-balancer configuration which would typically be unmarshalled from a JSON file at runtime.
|
This package provides structures representing a load-balancer configuration which would typically be unmarshalled from a JSON file at runtime. |