checks

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Check(ctx context.Context) Result
	Type() string
}

func NewChecker

func NewChecker(cfg *config.CheckConfig) (Checker, error)

type DNSChecker

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

func NewDNSChecker

func NewDNSChecker(cfg *config.DNSCheckConfig) *DNSChecker

func (*DNSChecker) Check

func (c *DNSChecker) Check(ctx context.Context) Result

func (*DNSChecker) Type

func (c *DNSChecker) Type() string

type HTTPChecker

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

func NewHTTPChecker

func NewHTTPChecker(cfg *config.HTTPCheckConfig) (*HTTPChecker, error)

func (*HTTPChecker) Check

func (c *HTTPChecker) Check(ctx context.Context) Result

func (*HTTPChecker) Type

func (c *HTTPChecker) Type() string

type HealthTransition

type HealthTransition struct {
	VIPName     string
	Healthy     bool
	Reason      string
	CheckResult Result
}

type PingChecker

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

func NewPingChecker

func NewPingChecker(cfg *config.PingCheckConfig) *PingChecker

func (*PingChecker) Check

func (c *PingChecker) Check(ctx context.Context) Result

func (*PingChecker) Type

func (c *PingChecker) Type() string

type Result

type Result struct {
	Success  bool          `json:"success"`
	Detail   string        `json:"detail"`
	Duration time.Duration `json:"duration"`
	Err      error         `json:"-"`
	TimedOut bool          `json:"timed_out,omitempty"`
}

type Scheduler

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

func NewScheduler

func NewScheduler(cfg SchedulerConfig) *Scheduler

func (*Scheduler) ConsecutiveFail

func (s *Scheduler) ConsecutiveFail() int

func (*Scheduler) ConsecutiveOK

func (s *Scheduler) ConsecutiveOK() int

func (*Scheduler) IsHealthy

func (s *Scheduler) IsHealthy() bool

func (*Scheduler) LastResult

func (s *Scheduler) LastResult() Result

func (*Scheduler) Run

func (s *Scheduler) Run(ctx context.Context)

func (*Scheduler) SetCallbacks

func (s *Scheduler) SetCallbacks(onTransition func(HealthTransition), onCheckResult func(string, Result))

func (*Scheduler) TriggerCheck

func (s *Scheduler) TriggerCheck(ctx context.Context) (Result, error)

func (*Scheduler) VIPName

func (s *Scheduler) VIPName() string

type SchedulerConfig

type SchedulerConfig struct {
	VIPName       string
	Checker       Checker
	Interval      time.Duration
	Timeout       time.Duration
	Rise          int
	Fall          int
	OnTransition  func(HealthTransition)
	OnCheckResult func(vipName string, result Result)
}

Jump to

Keyboard shortcuts

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