cue

package module
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: GPL-2.0 Imports: 6 Imported by: 0

README

Cue

A library to manage load balanced services. A balancer implementation is passed to as an interface to the Director, and configured with a list of services which include health check definitions.

Backend servers are added and removed from the balancer's pool by the Director according to the status of health checks.

A BGP implementation is included and may be used to advertise healthy virtual IP address to the network.

Primarily this is used in the vc5 load balancer and is subject to some change.

Documentation

Documentation is here.

Documentation

Index

Constants

View Source
const (
	TCP = 0x06
	UDP = 0x11
)

Variables

This section is empty.

Functions

func AllVIPs

func AllVIPs(services []Service) (r []netip.Addr)

func HealthyVIPs

func HealthyVIPs(services []Service) (r []netip.Addr)

Types

type Check

type Check = mon.Check

type Destination

type Destination struct {
	Address  netip.Addr  `json:"address"`
	Port     uint16      `json:"port"`
	Disabled bool        `json:"disabled"`
	Weight   uint8       `json:"weight"`
	Status   mon.Status  `json:"status"`
	Checks   []mon.Check `json:"checks"`
}

func (*Destination) HealthyWeight

func (d *Destination) HealthyWeight() uint8

If the destination is healthy then this function returns its weight. If unhealthy or disabled, zero is returned

type Director

type Director struct {
	// A channel which may be used to receive notifications of changes in status of backend servers.
	C chan bool

	Notifier mon.Notifier
	Prober   mon.Prober

	// Default IP address to use for network probes (needed for SYN, should be optional).
	Address netip.Addr
	// contains filtered or unexported fields
}

func (*Director) Configure

func (d *Director) Configure(config []Service) error

func (*Director) Start

func (d *Director) Start(cfg []Service) error

func (*Director) Status

func (d *Director) Status() (services []Service)

func (*Director) Stop

func (d *Director) Stop()

type Scheduler

type Scheduler = string

type Service

type Service struct {
	Address      netip.Addr
	Port         uint16
	Protocol     uint8
	Scheduler    string
	Sticky       bool
	Required     uint8
	Destinations []Destination

	Up   bool
	When time.Time
	// contains filtered or unexported fields
}

func (*Service) Available

func (s *Service) Available() uint8

func (*Service) Healthy

func (s *Service) Healthy() bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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