ping

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	context.Context
	// contains filtered or unexported fields
}

Context is used to track the execution of Pingers

type Manager

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

Manager starts and stops pinger instances based on configuration and DNS responses

func NewManager

func NewManager(hist *prometheus.HistogramVec, conf ManagerConfig) *Manager

NewManager returns a new instance of a ping Manager

func (*Manager) Run

func (m *Manager) Run(ctx context.Context) error

Run starts the manager. This will block until the context is canceled

type ManagerConfig

type ManagerConfig struct {
	Source     string
	DNSTargets []string
	IPTargets  []string

	UpdateInterval time.Duration
	PingInterval   time.Duration
	PingTimeout    time.Duration
}

ManagerConfig contains configuration of the Manager

type Pinger

type Pinger interface {
	Ping(ctx context.Context) error
}

Pinger provides a method to continuously ping a single configured endpoint

func NewPinger

func NewPinger(ip *net.IPAddr, obs observerVec, interval, timeout time.Duration) (Pinger, error)

NewPinger returns a new instance of pinger

Jump to

Keyboard shortcuts

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