ipaddr

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2021 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package ipaddr provides an ip address polling test utilizing the `ip` Unix command.

Index

Constants

View Source
const (
	// DeviceDoesNotExistRegex matches `ip addr` output when the given device does not exist.
	DeviceDoesNotExistRegex = `(?m)Device \"(\w+)\" does not exist.$`
	// SuccessfulOutputRegex matches `ip addr` output for a given device, and provides grouping to extract the associated Ipv4 address.
	SuccessfulOutputRegex = `` /* 173-byte string literal not displayed */
)

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAddr

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

IPAddr provides an ip addr test implemented using command line tool `ip addr`.

func NewIPAddr

func NewIPAddr(timeout time.Duration, device string) *IPAddr

NewIPAddr creates a new `ip addr` test for the given device.

func (*IPAddr) Args

func (i *IPAddr) Args() []string

Args returns the command line args for the test.

func (*IPAddr) GetIPv4Address

func (i *IPAddr) GetIPv4Address() string

GetIPv4Address returns the extracted IPv4 address for the given device (interface).

func (*IPAddr) GetIdentifier

func (i *IPAddr) GetIdentifier() identifier.Identifier

GetIdentifier returns the tnf.Test specific identifier.

func (*IPAddr) ReelEOF

func (i *IPAddr) ReelEOF()

ReelEOF does nothing; no intervention is needed for `ip addr` EOF.

func (*IPAddr) ReelFirst

func (i *IPAddr) ReelFirst() *reel.Step

ReelFirst returns a step which expects an ip summary for the given device.

func (*IPAddr) ReelMatch

func (i *IPAddr) ReelMatch(pattern, _, match string) *reel.Step

ReelMatch parses the ip addr output and set the test result on match. Returns no step; the test is complete.

func (*IPAddr) ReelTimeout

func (i *IPAddr) ReelTimeout() *reel.Step

ReelTimeout does nothing; no intervention is needed for `ip addr` timeout.

func (*IPAddr) Result

func (i *IPAddr) Result() int

Result returns the test result.

func (*IPAddr) Timeout

func (i *IPAddr) Timeout() time.Duration

Timeout return the timeout for the test.

Jump to

Keyboard shortcuts

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