Documentation
¶
Overview ¶
Package pinger implements ICMP ping functionality for the agent
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrRawSocketUnsupported is sent when the pinger is configured to use raw sockets // when raw socket based pings are not supported on the system ErrRawSocketUnsupported = errors.New("raw socket cannot be used with this OS") // ErrUDPSocketUnsupported is sent when the pinger is configured to use UDP sockets // when UDP socket based pings are not supported on the system ErrUDPSocketUnsupported = errors.New("udp socket cannot be used with this OS") )
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// UseRawSocket determines the socket type to use
// RAW or UDP
UseRawSocket bool
// Interval is the amount of time to wait between
// sending ICMP packets, default is 1 second
Interval time.Duration
// Timeout is the total time to wait for all pings
// to complete
Timeout time.Duration
// Count is the number of ICMP packets, pings, to send
Count int
}
Config defines how pings should be run across all hosts
type LinuxPinger ¶
type LinuxPinger struct {
// contains filtered or unexported fields
}
LinuxPinger implements the Pinger interface for Linux users
type MockPinger ¶
type MockPinger struct {
// contains filtered or unexported fields
}
MockPinger is a pinger used for testing
func NewMockPinger ¶
func NewMockPinger(res *Result, err error) *MockPinger
NewMockPinger returns a pinger that
type Result ¶
type Result struct {
// CanConnect is true if we receive a response from any
// of the packets on the host
CanConnect bool `json:"can_connect"`
// PacketLoss indicates the percentage of packets lost
PacketLoss float64 `json:"packet_loss"`
// AvgRtt is the average round trip time
AvgRtt time.Duration `json:"avg_rtt"`
}
Result encapsulates the results of a single run of ping
Click to show internal directories.
Click to hide internal directories.