haproxy

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HAProxyAllHostsTransitioning error = fmt.Errorf("Haproxy: all hosts are in transition. HAProxy is likely reloading")
View Source
var HAProxyAllUpHostsTransitioning error = fmt.Errorf("Haproxy: all host marked as UP are in transition. HAProxy is likely reloading")
View Source
var HAProxyEmptyBody error = fmt.Errorf("Haproxy GET error: empty body")
View Source
var HAProxyEmptyStatus error = fmt.Errorf("Haproxy CSV parsing error: no lines found")
View Source
var HAProxyMissingPool error = fmt.Errorf("Haproxy CSV parsing: pool not found")
View Source
var HAProxyPartialStatus error = fmt.Errorf("Haproxy CSV parsing error: only got partial file")
View Source
var MaxHTTPGetConcurrency = 2

Functions

func FilterThrotllerHosts

func FilterThrotllerHosts(backendHosts [](*BackendHost)) (hosts []string)

func Read

func Read(u *url.URL) (csv string, err error)

Read will read HAProxy URI and return with the CSV text

Types

type BackendHost

type BackendHost struct {
	Hostname        string
	Status          BackendHostStatus
	IsTransitioning bool
}

func NewBackendHost

func NewBackendHost(hostname string, status BackendHostStatus, isTransitioning bool) *BackendHost

func ParseCsvHosts

func ParseCsvHosts(csv string, poolName string) (backendHosts [](*BackendHost), err error)

ParseCsvHosts reads HAProxy CSV text and returns lists of hosts participating in the given pool (backend). See comment for ParseHosts

func ParseHosts

func ParseHosts(csvLines []string, poolName string) (backendHosts [](*BackendHost), err error)

ParseHosts reads HAProxy CSV lines and returns lists of hosts participating in the given pool (backend) Returned are all non-disabled hosts in given backend. Thus, a NOLB is skipped; any UP or DOWN hosts are returned. Such list indicates the hosts which can be expected to be active, which is then the list freno will probe.

type BackendHostStatus

type BackendHostStatus string
const (
	StatusDown    BackendHostStatus = "DOWN"
	StatusNOLB    BackendHostStatus = "NOLB"
	StatusUp      BackendHostStatus = "UP"
	StatusNoCheck BackendHostStatus = "no check"
	StatusUnknown BackendHostStatus = "unkown"
)

func ParseStatus

func ParseStatus(fullStatus string) (status BackendHostStatus, isTransitioning bool)

func ToBackendHostStatus

func ToBackendHostStatus(status string) BackendHostStatus

Jump to

Keyboard shortcuts

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