checkers

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalMinTimeout     = 2 * time.Second
	GlobalMaxTimeout     = 20 * time.Second
	GlobalDefaultTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

func RegisterChecker added in v0.6.0

func RegisterChecker(protocol Protocol, factory CheckerFactory)

Types

type BaseChecker added in v0.6.0

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

func NewBaseChecker added in v0.6.0

func NewBaseChecker(bounds TimeoutBounds) BaseChecker

func (*BaseChecker) Check added in v0.6.0

func (b *BaseChecker) Check(ctx context.Context, hosts []string, port string, checkFn func(ctx context.Context, host string, port string) (map[string]interface{}, error)) []HostCheckResult

func (*BaseChecker) GetTimeout added in v0.6.0

func (b *BaseChecker) GetTimeout() time.Duration

func (*BaseChecker) GetTimeoutBounds added in v0.6.0

func (b *BaseChecker) GetTimeoutBounds() TimeoutBounds

func (*BaseChecker) SetTimeout added in v0.6.0

func (b *BaseChecker) SetTimeout(timeout time.Duration) error

func (*BaseChecker) ValidateTimeout added in v0.6.0

func (b *BaseChecker) ValidateTimeout(timeout time.Duration) (time.Duration, error)

type CertInfo

type CertInfo struct {
	ExpiresAt time.Time
	IssuedBy  string
}

type CheckError added in v0.6.0

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

func (*CheckError) Error added in v0.6.0

func (e *CheckError) Error() string

func (*CheckError) Metadata added in v0.6.0

func (e *CheckError) Metadata() map[string]interface{}

type CheckResult

type CheckResult struct {
	Error        error
	Metadata     map[string]interface{}
	ResponseTime time.Duration
	Success      bool
}

type Checker

type Checker interface {
	Protocol() Protocol
	Check(ctx context.Context, hosts []string, port string) []HostCheckResult
	GetTimeout() time.Duration
	SetTimeout(timeout time.Duration) error
}

func NewChecker

func NewChecker(protocol Protocol) (Checker, error)

type CheckerFactory added in v0.6.0

type CheckerFactory func() Checker

type DNSChecker

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

func NewDNSChecker

func NewDNSChecker() *DNSChecker

func (*DNSChecker) Check

func (c *DNSChecker) Check(ctx context.Context, hosts []string, port string) []HostCheckResult

func (*DNSChecker) Protocol

func (c *DNSChecker) Protocol() Protocol

type HTTPChecker

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

func NewHTTPChecker

func NewHTTPChecker() *HTTPChecker

func (*HTTPChecker) Check

func (c *HTTPChecker) Check(ctx context.Context, hosts []string, port string) []HostCheckResult

func (*HTTPChecker) Protocol

func (c *HTTPChecker) Protocol() Protocol

type HTTPSChecker

type HTTPSChecker struct {
	BaseChecker
	// contains filtered or unexported fields
}

func NewHTTPSChecker

func NewHTTPSChecker() *HTTPSChecker

func (*HTTPSChecker) Check

func (c *HTTPSChecker) Check(ctx context.Context, hosts []string, port string) []HostCheckResult

func (*HTTPSChecker) Protocol

func (c *HTTPSChecker) Protocol() Protocol

type HostCheckResult added in v0.5.4

type HostCheckResult struct {
	Host string
	CheckResult
}

type Protocol

type Protocol string

func ListProtocols added in v0.6.0

func ListProtocols() []Protocol

for future use to list all protocols when some cli flag is used

func (Protocol) IsValid added in v0.6.0

func (p Protocol) IsValid() bool

func (Protocol) String added in v0.6.0

func (p Protocol) String() string

type Registry added in v0.6.0

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

type SMTPChecker

type SMTPChecker struct {
	BaseChecker
	// contains filtered or unexported fields
}

func NewSMTPChecker

func NewSMTPChecker() *SMTPChecker

func (*SMTPChecker) Check

func (c *SMTPChecker) Check(ctx context.Context, hosts []string, port string) []HostCheckResult

func (*SMTPChecker) Protocol

func (c *SMTPChecker) Protocol() Protocol

type TCPChecker

type TCPChecker struct {
	BaseChecker
	// contains filtered or unexported fields
}

func NewTCPChecker

func NewTCPChecker() *TCPChecker

func (*TCPChecker) Check

func (c *TCPChecker) Check(ctx context.Context, hosts []string, port string) []HostCheckResult

func (*TCPChecker) Protocol

func (c *TCPChecker) Protocol() Protocol

type TimeoutBounds added in v0.6.0

type TimeoutBounds struct {
	Min     time.Duration
	Max     time.Duration
	Default time.Duration
}

Jump to

Keyboard shortcuts

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