Documentation ¶
Overview ¶
Package healthcheck implements backend and service healthchecks.
Index ¶
- Constants
- func DNSType(name string) (uint16, error)
- type Check
- type Checker
- type Checks
- type Config
- type DNSChecker
- type HTTPChecker
- type HealthState
- type Id
- type Notification
- type PingChecker
- type RADIUSChecker
- type Result
- type Server
- type ServerConfig
- type State
- type Status
- type TCPChecker
- type Target
- type UDPChecker
Constants ¶
const ( ICMP4_ECHO_REQUEST = 8 ICMP4_ECHO_REPLY = 0 ICMP6_ECHO_REQUEST = 128 ICMP6_ECHO_REPLY = 129 )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Check ¶
type Check struct { Config // contains filtered or unexported fields }
Check represents a healthcheck instance.
func NewCheck ¶
func NewCheck(notify chan<- *Notification) *Check
NewCheck returns an initialised Check.
func (*Check) Notify ¶
func (hc *Check) Notify()
Notify generates a healthcheck notification for this checker.
func (*Check) Run ¶
Run invokes a healthcheck. It waits for the initial configuration to be provided via the configuration channel, after which the configured healthchecker is invoked at the given interval. If a new configuration is provided the healthchecker is updated and checks are scheduled at the new interval. Notifications are generated and sent via the notification channel whenever a state transition occurs. Run will terminate once a value is received on the quit channel.
type DNSChecker ¶
DNSChecker contains configuration specific to a DNS healthcheck.
func NewDNSChecker ¶
func NewDNSChecker(ip net.IP, port int) *DNSChecker
NewDNSChecker returns an initialised DNSChecker.
func (*DNSChecker) Check ¶
func (hc *DNSChecker) Check(timeout time.Duration) *Result
Check executes a DNS healthcheck.
func (*DNSChecker) String ¶
func (hc *DNSChecker) String() string
String returns the string representation of a DNS healthcheck.
type HTTPChecker ¶
type HTTPChecker struct { Target Secure bool TLSVerify bool Method string Proxy bool Request string Response string ResponseCode int }
HTTPChecker contains configuration specific to a HTTP healthcheck.
func NewHTTPChecker ¶
func NewHTTPChecker(ip net.IP, port int) *HTTPChecker
NewHTTPChecker returns an initialised HTTPChecker.
func (*HTTPChecker) Check ¶
func (hc *HTTPChecker) Check(timeout time.Duration) *Result
Check executes a HTTP healthcheck.
func (*HTTPChecker) String ¶
func (hc *HTTPChecker) String() string
String returns the string representation of an HTTP healthcheck.
type HealthState ¶
type HealthState struct { Ctx *ipc.Context Notifications []*Notification }
HealthState contains data for a healthcheck state IPC.
type Notification ¶
Notification stores a status notification for a healthcheck.
func (*Notification) String ¶
func (n *Notification) String() string
String returns the string representation for the given notification.
type PingChecker ¶
PingChecker contains configuration specific to a ping healthcheck.
func NewPingChecker ¶
func NewPingChecker(ip net.IP) *PingChecker
NewPingChecker returns an initialised PingChecker.
func (*PingChecker) Check ¶
func (hc *PingChecker) Check(timeout time.Duration) *Result
Check executes a ping healthcheck.
func (*PingChecker) String ¶
func (hc *PingChecker) String() string
String returns the string representation of a Ping healthcheck.
type RADIUSChecker ¶
RADIUSChecker contains configuration specific to a RADIUS healthcheck.
func NewRADIUSChecker ¶
func NewRADIUSChecker(ip net.IP, port int) *RADIUSChecker
NewRADIUSChecker returns an initialised RADIUSChecker.
func (*RADIUSChecker) Check ¶
func (hc *RADIUSChecker) Check(timeout time.Duration) *Result
Check executes a RADIUS healthcheck.
func (*RADIUSChecker) String ¶
func (hc *RADIUSChecker) String() string
String returns the string representation of a RADIUS healthcheck.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains the data needed to run a healthcheck server.
func NewServer ¶
func NewServer(cfg *ServerConfig) *Server
NewServer returns an initialised healthcheck server.
type ServerConfig ¶
type ServerConfig struct { BatchDelay time.Duration BatchSize int ChannelSize int EngineSocket string MaxFailures int NotifyInterval time.Duration RetryDelay time.Duration }
ServerConfig specifies the configuration for a healthcheck server.
func DefaultServerConfig ¶
func DefaultServerConfig() ServerConfig
DefaultServerConfig returns the default server configuration.
type Status ¶
type Status struct { LastCheck time.Time Duration time.Duration Failures uint64 Successes uint64 State Message string }
Status represents the current status of a healthcheck instance.
type TCPChecker ¶
TCPChecker contains configuration specific to a TCP healthcheck.
func NewTCPChecker ¶
func NewTCPChecker(ip net.IP, port int) *TCPChecker
NewTCPChecker returns an initialised TCPChecker.
func (*TCPChecker) Check ¶
func (hc *TCPChecker) Check(timeout time.Duration) *Result
Check executes a TCP healthcheck.
func (*TCPChecker) String ¶
func (hc *TCPChecker) String() string
String returns the string representation of a TCP healthcheck.
type Target ¶
type Target struct { IP net.IP // IP address of the healthcheck target. Host net.IP // Host to run the healthcheck against. Mark int Mode seesaw.HealthcheckMode Port int Proto seesaw.IPProto }
Target specifies the target for a healthcheck.
type UDPChecker ¶
UDPChecker contains configuration specific to a UDP healthcheck.
func NewUDPChecker ¶
func NewUDPChecker(ip net.IP, port int) *UDPChecker
NewUDPChecker returns an initialised UDPChecker.
func (*UDPChecker) Check ¶
func (hc *UDPChecker) Check(timeout time.Duration) *Result
Check executes a UDP healthcheck.
func (*UDPChecker) String ¶
func (hc *UDPChecker) String() string
String returns the string representation of a UDP healthcheck.