pinger

package
v0.0.0-...-0ca7422 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MessageStruct

type MessageStruct struct {
	MessagePositive, MessageNegative                   string
	SkipReachableMessageOut, SkipUnreachableMessageOut bool
}

MessageStruct - holds all relevant information about passed message details.

type Target

type Target struct {
	Address, Filepath   string
	Count, TTL, Size    int
	Timeout, Interval   time.Duration
	Privileged, Stdout  bool
	PacketLossThreshold float64
	Message             MessageStruct
}

Target - holds pro-bing ("github.com/prometheus-community/pro-bing") parameters enriched with Message details and other.

func (Target) IsTargetReachable

func (t Target) IsTargetReachable(packetLoss float64) bool

IsTargetReachable - returns true or false based if the PacketLossThreshold has been breached.

func (Target) Out

func (t Target) Out(reachable bool) (err error)

Out - determines if and what message should be printed, either to standard output or to the file specified in the filepath.

func (Target) PingIt

func (t Target) PingIt() (stats *probing.Statistics, err error)

PingIt - creates a NawPinger, sets various parameters for it and returns statistics gathered. Writes ping details to standard output.

func (*Target) SetExtendedDefaults

func (t *Target) SetExtendedDefaults()

SetExtendedDefaults - extends default MessagePositive and MessageNegative with Address if no custom message value was specified.

func (*Target) Validate

func (t *Target) Validate() (err error)

Validate - validates passed values to flags.

Jump to

Keyboard shortcuts

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