health

package
v0.0.0-...-542e895 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRecordUpdateFailed = errors.New("record update failed")
	ErrRecordIPNotSet     = errors.New("record IP not set")
	ErrLookupMismatch     = errors.New("lookup IP addresses do not match")
)
View Source
var (
	ErrHTTPStatusCodeNotOK = errors.New("status code is not OK")
)
View Source
var ErrUnhealthy = errors.New("program is unhealthy")

Functions

func CheckHTTP

func CheckHTTP(ctx context.Context, client *http.Client) (err error)

func MakeIsHealthy

func MakeIsHealthy(db AllSelecter, resolver LookupIPer) func() error

Types

type AllSelecter

type AllSelecter interface {
	SelectAll() (records []records.Record)
}

type Client

type Client struct {
	*http.Client
}

func NewClient

func NewClient() *Client

func (*Client) Query

func (c *Client) Query(ctx context.Context, listeningAddress string) error

Query sends an HTTP request to the other instance of the program, and to its internal healthcheck server.

type Logger

type Logger interface {
	Info(s string)
	Warn(s string)
	Error(s string)
}

type LookupIPer

type LookupIPer interface {
	LookupIP(ctx context.Context, network, host string) (ips []net.IP, err error)
}

type Server

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

func NewServer

func NewServer(address string, logger Logger, healthcheck func() error) *Server

func (*Server) Run

func (s *Server) Run(ctx context.Context, done chan<- struct{})

Jump to

Keyboard shortcuts

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