Documentation ¶
Index ¶
Constants ¶
View Source
const ( ProtocolICMP = 1 ProtocolIPv6ICMP = 58 // ICMP for IPv6 )
see https://godoc.org/golang.org/x/net/ping/internal/iana#pkg-constants
View Source
const (
// TimeSliceLength is the length of the icmp payload holding the timestamp
TimeSliceLength = 8
)
Variables ¶
View Source
var ErrTooShort = errors.New("too short")
ErrTooShort is returned if an echo body holding the timeslice is too short
Functions ¶
func BytesToTime ¶
BytesToTime converst a []byte into a time.Time
func TimeToBytes ¶
TimeToBytes converts a time.Time into a []byte for inclusion in the ICMP payload
Types ¶
type Ping ¶
type Ping struct { // Host is the hostname that was pinged Host string // Src is the source IP. This is probably 0.0.0.0 for sent packets, but a // specific IP on the sending host for recieved packets Src *net.IPAddr // Dst is the destination IP. // This will be nil for recieved packets on windows. The reason is that // the recieve function does not provide the source address // on windows ICMP messages are mathed only by the 16 bit ICMP id. Dst *net.IPAddr // Count is the ICMP count Count int // ID is the ICMP ID ID ID // Seq is the ICMP Sequence Seq Seq // Sent is the time the echo was sent Sent time.Time // Recieved is the time the echo was recieved. Recieved time.Time // TimeOut is timeout duration TimeOut time.Duration // TTL is the ttl on the recieved packet. // This is not supported on windows and will always be zero TTL int // Len is the length of the recieved packet Len int }
Ping is an ICMP packet that has been received
func (*Ping) TimeOutTime ¶
TimeOutTime returns the time this ping times out
func (*Ping) UpdateFrom ¶
UpdateFrom is for updating a sent ping with attributes from a recieved ping
Click to show internal directories.
Click to hide internal directories.