health

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyCheckName     = errors.New("name of the check must not be empty")
	ErrAmbiguousCheckName = errors.New("a check with the same name is already registered")
	ErrNoClientForModule  = errors.New("no client for module registered")
)

Functions

func HTTP2Client added in v0.7.0

func HTTP2Client(cfg Config, tlsConfig *tls.Config) *gohttp.Client

func HTTPClient added in v0.6.0

func HTTPClient(cfg Config, tlsConfig *tls.Config) *gohttp.Client

func NewHealthHandler added in v0.6.0

func NewHealthHandler(checker Checker) http.Handler

Types

type Check

type Check interface {
	Name() string
	Status(ctx context.Context) error
}

func NewCheckFunc added in v0.6.0

func NewCheckFunc(name string, delegate func(ctx context.Context) error) Check

func NewDNSRuleCheck added in v0.6.0

func NewDNSRuleCheck(name string, resolvers ResolverForModule, logger logging.Logger, check *rules.Check) (Check, error)

func NewHTTPRuleCheck added in v0.6.0

func NewHTTPRuleCheck(name string, clients HTTPClientForModule, logger logging.Logger, check *rules.Check) (Check, error)

type Checker

type Checker interface {
	AddCheck(check Check) error
	Status(ctx context.Context) Result
}

func New

func New() Checker

func NewFromConfig added in v0.6.0

func NewFromConfig(logger logging.Logger, cfg Config, tlsConfig *tls.Config) (Checker, error)

type ClientsConfig added in v0.6.0

type ClientsConfig struct {
	HTTP  Server
	HTTPS Server
	DNS   Server
	DoT   Server
}

type ClientsForModuleMap added in v0.7.0

type ClientsForModuleMap map[string]*gohttp.Client

func (ClientsForModuleMap) ClientForModule added in v0.7.0

func (c ClientsForModuleMap) ClientForModule(module string) (*gohttp.Client, error)

type Config added in v0.6.0

type Config struct {
	Client ClientsConfig
	Rules  []ValidationRule
}

type HTTPClientForModule added in v0.7.0

type HTTPClientForModule interface {
	ClientForModule(module string) (*gohttp.Client, error)
}

func HTTPClients added in v0.7.0

func HTTPClients(cfg Config, tlsConfig *tls.Config) HTTPClientForModule

type ResolverForModule added in v0.7.0

type ResolverForModule interface {
	ResolverForModule(module string) (dns.Resolver, error)
}

func Resolvers added in v0.7.0

func Resolvers(cfg Config, tlsConfig *tls.Config) ResolverForModule

type ResolversForModuleMap added in v0.7.0

type ResolversForModuleMap map[string]dns.Resolver

func (ResolversForModuleMap) ResolverForModule added in v0.7.0

func (d ResolversForModuleMap) ResolverForModule(module string) (dns.Resolver, error)

type Result

type Result map[string]error

func (Result) CheckResult added in v0.6.0

func (r Result) CheckResult(name string) (knownCheck bool, result error)

func (Result) IsHealthy added in v0.6.0

func (r Result) IsHealthy() (healthy bool)

func (Result) MarshalJSON added in v0.6.0

func (r Result) MarshalJSON() ([]byte, error)

type ResultWriter added in v0.6.0

type ResultWriter interface {
	WriteResult(checkName string, result error)
	GetResult() Result
}

func NewResultWriter added in v0.6.0

func NewResultWriter() ResultWriter

type Server added in v0.6.0

type Server struct {
	IP    string
	Port  uint16
	Proto string
}

type ValidationRule added in v0.6.0

type ValidationRule struct {
	Name string
	Rule string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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