mon

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GET  method = false
	HEAD method = true
	UDP  method = false
	TCP  method = true
)
View Source
const F = "mon"

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	// Type of check; http, https, syn, dns
	Type string `json:"type,omitempty"`

	// TCP/UDP port to use for L4/L7 checks
	Port uint16 `json:"port,omitempty"`

	// HTTP Host header to send in healthcheck
	Host string `json:"host,omitempty"`

	// Path of resource to use when building a URI for HTTP/HTTPS healthchecks
	Path string `json:"path,omitempty"`

	// Expected HTTP status codes to allow check to succeed
	Expect []int `json:"expect,omitempty"`

	// Method - HTTP: GET=false, HEAD=true DNS: UDP=false TCP=true
	Method method `json:"method,omitempty"`
}

type Checks

type Checks = []Check

type Destination

type Destination struct {
	Address netip.Addr
	Port    uint16
}

type Instance

type Instance struct {
	Service     Service
	Destination Destination
}

type KV added in v0.0.6

type KV = map[string]any

type Mon

type Mon struct {
	C chan bool
	// contains filtered or unexported fields
}

func New

func New(addr netip.Addr, services map[Instance]Target, p Prober, l log.Log) (*Mon, error)

func (*Mon) DNS

func (m *Mon) DNS(addr netip.Addr, port uint16, useTCP bool) (bool, string)

func (*Mon) Dump

func (m *Mon) Dump() map[Instance]Status

func (*Mon) HTTP

func (m *Mon) HTTP(addr netip.Addr, port uint16, https bool, head bool, host, path string, expect ...int) (bool, string)

func (*Mon) Probe

func (m *Mon) Probe(vip, addr netip.Addr, c Check) (ok bool, s string)

func (*Mon) Probes

func (m *Mon) Probes(vip, rip netip.Addr, port uint16, checks Checks) (bool, string)

func (*Mon) SYN

func (m *Mon) SYN(addr netip.Addr, port uint16) (bool, string)

func (*Mon) Status

func (m *Mon) Status(svc Service, dst Destination) (status Status, _ bool)

func (*Mon) Stop

func (m *Mon) Stop()

func (*Mon) Update

func (m *Mon) Update(checks map[Instance]Target)

type Prober

type Prober interface {
	Probe(netip.Addr, netip.Addr, Check) (bool, string)
}

type SYN

type SYN struct {
	// contains filtered or unexported fields
}

func Syn

func Syn(addr netip.Addr, rst bool) (*SYN, error)

func (*SYN) Check

func (s *SYN) Check(dst [4]byte, port uint16) (bool, string)

func (*SYN) Probe

func (s *SYN) Probe(addr netip.Addr, port uint16) bool

type Service

type Service struct {
	Address  netip.Addr
	Port     uint16
	Protocol uint8
}

type Services

type Services map[Instance]Checks

type Status

type Status struct {
	OK          bool
	Diagnostic  string
	Took        time.Duration
	Last        time.Time
	When        time.Time
	Initialised bool
}

type SynChecks

type SynChecks = SYN

type Target

type Target struct {
	Init   bool
	Checks Checks
}

Jump to

Keyboard shortcuts

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