Documentation
¶
Index ¶
- type Checker
- type DNSChecker
- type GRPCChecker
- type HTTPChecker
- type HealthTransition
- type PingChecker
- type Result
- type Scheduler
- func (s *Scheduler) ConsecutiveFail() int
- func (s *Scheduler) ConsecutiveOK() int
- func (s *Scheduler) IsHealthy() bool
- func (s *Scheduler) LastResult() Result
- func (s *Scheduler) Run(ctx context.Context)
- func (s *Scheduler) SetCallbacks(onTransition func(HealthTransition), onCheckResult func(string, Result))
- func (s *Scheduler) TriggerCheck(ctx context.Context) (Result, error)
- func (s *Scheduler) VIPName() string
- type SchedulerConfig
- type TCPChecker
- type UDPChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
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) Type ¶
func (c *DNSChecker) Type() string
type GRPCChecker ¶ added in v0.5.0
type GRPCChecker struct {
// contains filtered or unexported fields
}
GRPCChecker performs a gRPC health check.
When cfg.Method is empty it uses the standard gRPC Health Checking Protocol (grpc.health.v1.Health/Check) and requires the response status to be SERVING.
When cfg.Method is set it calls that unary RPC with an empty proto3 request and considers the call passing if the returned gRPC status code is in OKCodes (default: OK). This mirrors the HTTP checker's response_codes semantics.
func NewGRPCChecker ¶ added in v0.5.0
func NewGRPCChecker(cfg *config.GRPCCheckConfig) (*GRPCChecker, error)
func (*GRPCChecker) Type ¶ added in v0.5.0
func (c *GRPCChecker) Type() string
type HTTPChecker ¶
type HTTPChecker struct {
// contains filtered or unexported fields
}
func NewHTTPChecker ¶
func NewHTTPChecker(cfg *config.HTTPCheckConfig) (*HTTPChecker, error)
func (*HTTPChecker) Type ¶
func (c *HTTPChecker) Type() string
type HealthTransition ¶
type HealthTransition struct {
Ctx context.Context // trace context; may be nil when called synthetically
VIPName string
Healthy bool
Reason string
CheckResult Result
}
HealthTransition is fired when a VIP crosses the rise or fall threshold. Ctx carries the trace context of the check that caused the transition so that downstream operations (e.g. BGP announce/withdraw) appear as child spans.
type PingChecker ¶
type PingChecker struct {
// contains filtered or unexported fields
}
func NewPingChecker ¶
func NewPingChecker(cfg *config.PingCheckConfig) *PingChecker
func (*PingChecker) Type ¶
func (c *PingChecker) Type() string
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func NewScheduler ¶
func NewScheduler(cfg SchedulerConfig) *Scheduler
func (*Scheduler) ConsecutiveFail ¶
func (*Scheduler) ConsecutiveOK ¶
func (*Scheduler) LastResult ¶
func (*Scheduler) SetCallbacks ¶
func (s *Scheduler) SetCallbacks(onTransition func(HealthTransition), onCheckResult func(string, Result))
func (*Scheduler) TriggerCheck ¶
type SchedulerConfig ¶
type TCPChecker ¶ added in v0.3.0
type TCPChecker struct {
// contains filtered or unexported fields
}
TCPChecker dials host:port over TCP. A successful connection means the port is open and accepting connections; the connection is closed immediately after.
func NewTCPChecker ¶ added in v0.3.0
func NewTCPChecker(cfg *config.TCPCheckConfig) *TCPChecker
func (*TCPChecker) Type ¶ added in v0.3.0
func (c *TCPChecker) Type() string
type UDPChecker ¶ added in v0.3.0
type UDPChecker struct {
// contains filtered or unexported fields
}
UDPChecker probes a UDP port by sending a small datagram and waiting for an ICMP port-unreachable reply. On Linux, when a UDP socket is connected and a datagram is sent to a port with no listener, the kernel delivers the ICMP error back to the socket as ECONNREFUSED on the next I/O call — without requiring elevated privileges or raw sockets.
Decision logic:
- ECONNREFUSED on read → nothing is listening → check fails
- Read timeout (no ICMP received) → datagram was accepted → check passes
- Actual data received → server responded → check passes
func NewUDPChecker ¶ added in v0.3.0
func NewUDPChecker(cfg *config.UDPCheckConfig) *UDPChecker
func (*UDPChecker) Type ¶ added in v0.3.0
func (c *UDPChecker) Type() string