command

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

from https://github.com/sggms/go-pingparse

from https://github.com/sggms/go-pingparse

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotEnoughLines       = errors.New("not enough lines")
	ErrHeaderMismatch       = errors.New("header mismatch")
	ErrUnknownHost          = errors.New("unkown host")
	ErrUnrecognizedLine     = errors.New("unrecognized ping reply line")
	ErrMalformedStatsHeader = errors.New("malformed stats header")
	ErrMalformedStatsLine1  = errors.New("malformed stats line 1")
	ErrMalformedStatsLine2  = errors.New("malformed stats line 2")
)

Functions

This section is empty.

Types

type ConversionError

type ConversionError struct {
	Context string
	Err     error
}

func (ConversionError) Error

func (ce ConversionError) Error() string

type PingOutput

type PingOutput struct {
	Host              string
	ResolvedIPAddress string
	PayloadSize       uint
	PayloadActualSize uint
	Replies           []PingReply
	Stats             PingStatistics
}

PingOutput contains the whole ping operation output.

func Parse

func Parse(s string) (*PingOutput, error)

Parse will parse the specified ping output and return all the information in a a PingOutput object.

func Ping

func Ping(ipV4Address string, interval, timeout int, count int, sourceAddr string) (*PingOutput, error)

Ping will ping the specified IPv4 address wit the provided timeout, interval and size settings .

type PingReply

type PingReply struct {
	Size           uint
	FromAddress    string
	SequenceNumber uint
	TTL            uint
	Time           time.Duration
	Error          string
	Duplicate      bool
}

PingReply contains an individual ping reply line.

type PingStatistics

type PingStatistics struct {
	IPAddress          string
	PacketsTransmitted uint
	PacketsReceived    uint
	Errors             uint
	PacketLossPercent  float32
	Time               time.Duration
	RoundTripMin       time.Duration
	RoundTripAverage   time.Duration
	RoundTripMax       time.Duration
	RoundTripDeviation time.Duration
	Warning            string
}

PingStatistics contains the statistics of the whole ping operation.

Jump to

Keyboard shortcuts

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