probe

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

probe package implements how to check the target status.

Index

Constants

View Source
const (
	HTTP_REDIRECT_MAX = 10
)

Variables

View Source
var (
	ErrUnsupportedDNSType = errors.New("unsupported DNS type")
	ErrConflictDNSType    = errors.New("DNS type in scheme and query is conflicted")
	ErrMissingDomainName  = errors.New("missing domain name")
)
View Source
var (
	ErrInvalidURL        = errors.New("invalid URL")
	ErrMissingScheme     = errors.New("missing scheme in URL")
	ErrUnsupportedScheme = errors.New("unsupported scheme")
	ErrMissingHost       = errors.New("missing target host")
)
View Source
var (
	ErrInvalidSource = errors.New("invalid source")
	ErrMissingFile   = errors.New("missing file")
)
View Source
var (
	ErrFailedToPreparePing = errors.New("failed to setup ping service")
)
View Source
var (
	ErrMissingCommand = errors.New("missing command")
)
View Source
var (
	ErrRedirectLoopDetected = errors.New("redirect loop detected")
)
View Source
var (
	ErrTCPPortMissing = errors.New("TCP target's port number is required")
)
View Source
var (
	HTTPUserAgent = "ayd health check"
)

Functions

func CheckPingPermission

func CheckPingPermission() error

func ExecutePlugin

func ExecutePlugin(ctx context.Context, r Reporter, scope string, target *url.URL, command string, args, env []string)

func SplitScheme

func SplitScheme(scheme string) (probe string, separator rune, variant string)

Types

type DNSProbe

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

func NewDNSProbe

func NewDNSProbe(u *url.URL) (DNSProbe, error)

func (DNSProbe) Check

func (p DNSProbe) Check(ctx context.Context, r Reporter)

func (DNSProbe) Target

func (p DNSProbe) Target() *url.URL

type DummyProbe

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

func NewDummyProbe

func NewDummyProbe(u *url.URL) (DummyProbe, error)

func (DummyProbe) Check

func (p DummyProbe) Check(ctx context.Context, r Reporter)

func (DummyProbe) Status

func (p DummyProbe) Status() api.Status

func (DummyProbe) Target

func (p DummyProbe) Target() *url.URL

type ExecuteProbe

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

func NewExecuteProbe

func NewExecuteProbe(u *url.URL) (ExecuteProbe, error)

func (ExecuteProbe) Check

func (p ExecuteProbe) Check(ctx context.Context, r Reporter)

func (ExecuteProbe) Target

func (p ExecuteProbe) Target() *url.URL

type HTTPProbe

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

func NewHTTPProbe

func NewHTTPProbe(u *url.URL) (HTTPProbe, error)

func (HTTPProbe) Check

func (p HTTPProbe) Check(ctx context.Context, r Reporter)

func (HTTPProbe) Target

func (p HTTPProbe) Target() *url.URL

type PingProbe

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

func NewPingProbe

func NewPingProbe(u *url.URL) (PingProbe, error)

func (PingProbe) Check

func (p PingProbe) Check(ctx context.Context, r Reporter)

func (PingProbe) Target

func (p PingProbe) Target() *url.URL

type PluginProbe

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

func NewPluginProbe

func NewPluginProbe(u *url.URL) (PluginProbe, error)

func (PluginProbe) Check

func (p PluginProbe) Check(ctx context.Context, r Reporter)

func (PluginProbe) Target

func (p PluginProbe) Target() *url.URL

type Probe

type Probe interface {
	Target() *url.URL
	Check(context.Context, Reporter)
}

func New

func New(rawURL string) (Probe, error)

func NewFromURL

func NewFromURL(u *url.URL) (Probe, error)

func WithoutPlugin

func WithoutPlugin(p Probe, err error) (Probe, error)

type Reporter

type Reporter interface {
	Report(r api.Record)
}

type ResourceLocker

type ResourceLocker struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewResourceLocker

func NewResourceLocker() *ResourceLocker

func (*ResourceLocker) Done

func (rl *ResourceLocker) Done()

func (*ResourceLocker) Start

func (rl *ResourceLocker) Start(prepareResource func() (teardown func(), err error)) error

type SourceProbe

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

func NewSourceProbe

func NewSourceProbe(u *url.URL) (SourceProbe, error)

func (SourceProbe) Check

func (p SourceProbe) Check(ctx context.Context, r Reporter)

func (SourceProbe) Target

func (p SourceProbe) Target() *url.URL

type TCPProbe

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

func NewTCPProbe

func NewTCPProbe(u *url.URL) (TCPProbe, error)

func (TCPProbe) Check

func (p TCPProbe) Check(ctx context.Context, r Reporter)

func (TCPProbe) Target

func (p TCPProbe) Target() *url.URL

Jump to

Keyboard shortcuts

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