Documentation
¶
Overview ¶
Package ping provides a test ICMPv4 implementation using the `ping` Unix command.
Index ¶
- Constants
- func Command(host string, count int) []string
- type Ping
- func (p *Ping) Args() []string
- func (p *Ping) GetIdentifier() identifier.Identifier
- func (p *Ping) GetReelFirstRegularExpressions() []string
- func (p *Ping) GetStats() (transmitted, received, errors int)
- func (p *Ping) ReelEOF()
- func (p *Ping) ReelFirst() *reel.Step
- func (p *Ping) ReelMatch(_, _, match string) *reel.Step
- func (p *Ping) ReelTimeout() *reel.Step
- func (p *Ping) Result() int
- func (p *Ping) Timeout() time.Duration
Constants ¶
const ( // ConnectInvalidArgumentRegex is a regex which matches when an invalid IP address or hostname is provided as input. ConnectInvalidArgumentRegex = `(?m)connect: Invalid argument$` // SuccessfulOutputRegex matches a successfully run "ping" command. That does not mean that no errors or drops // occurred during the test. SuccessfulOutputRegex = `(?m)(\d+) packets transmitted, (\d+)( packets){0,1} received, (?:\+(\d+) errors)?.*$` )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Ping ¶
type Ping struct {
// contains filtered or unexported fields
}
Ping provides a ping test implemented using command line tool `ping`.
func NewPing ¶
NewPing creates a new `Ping` test which pings `hosts` with `count` requests, or indefinitely if `count` is not positive, and executes within `timeout` seconds.
func (*Ping) GetIdentifier ¶
func (p *Ping) GetIdentifier() identifier.Identifier
GetIdentifier returns the tnf.Test specific identifier.
func (*Ping) GetReelFirstRegularExpressions ¶
GetReelFirstRegularExpressions returns the regular expressions used for matching in ReelFirst.
func (*Ping) ReelEOF ¶
func (p *Ping) ReelEOF()
ReelEOF does nothing; ping requires no intervention on eof.
func (*Ping) ReelFirst ¶
ReelFirst returns a step which expects the ping statistics within the test timeout.
func (*Ping) ReelMatch ¶
ReelMatch parses the ping statistics and set the test result on match. The result is success if at least one response was received and the number of responses received is at most one less than the number received (the "missing" response may be in flight). The result is error if ping reported a protocol error (e.g. destination host unreachable), no requests were sent or there was some test execution error. Otherwise the result is failure. Returns no step; the test is complete.
func (*Ping) ReelTimeout ¶
ReelTimeout returns a step which kills the ping test by sending it ^C.