prober

package
v3.12.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProbeTimeout = errors.New("probe timed out")

Functions

This section is empty.

Types

type OptionFunc added in v3.2.0

type OptionFunc func(p *Prober) error

func WithClient added in v3.2.0

func WithClient(client *http.Client) OptionFunc

WithClient returns an OptionFunc which tells the Prober to use the specified client for probing.

func WithLogger added in v3.2.0

func WithLogger(logger *log.Logger) OptionFunc

WithLogger returns an OptionFunc which tells the Prober to use the specified logger.

type Prober

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

Prober is an object that polls and http URL and returns an error if it does not return 200 Ok within the specified timeout.

func New

func New(timeout, backoff time.Duration, options ...OptionFunc) (*Prober, error)

New creates a Prober that will check an endpoint every backoff seconds.

func (*Prober) Probe

func (p *Prober) Probe(url string) error

Probe repeatedly hits the specified url with a GET request every Prober.backoff, and blocks until a request returns 200, or Prober.timeout passes.

Jump to

Keyboard shortcuts

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