ping

package module
v0.0.0-...-d12a975 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2016 License: BSD-3-Clause Imports: 7 Imported by: 0

README

ping

Concurrent ICMP ping utility.

GoDoc

Documentation

Overview

Package ping implements ICMP ping functions.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAddr = errors.New("ping: invalid address")
	ErrClosed      = errors.New("ping: closed")
	ErrTimeout     = errors.New("ping: timeout")
)

Errors

Functions

This section is empty.

Types

type Pinger

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

Pinger implements ping functions.

func New

func New(laddr string) (*Pinger, error)

New returns new pinger with specified local socket address.

func (*Pinger) Close

func (p *Pinger) Close() error

Close stops all pending requests and closes socket.

func (*Pinger) Once

func (p *Pinger) Once(raddr string, deadline time.Duration) (rtt time.Duration, err error)

Once sends single echo packet to raddr and returns round trip time.

func (*Pinger) Ping

func (p *Pinger) Ping(raddr string, deadline time.Duration, count int, delay time.Duration) ([]Result, error)

Ping sends count echo requests to raddr with specified delay.

type Result

type Result struct {
	From     string        // TODO: fill this field with address we received ICMP packet from.
	Type     ipv4.ICMPType // TODO: fill this field with received ICMP packet type.
	Sent     time.Time
	Received time.Time
}

Result is a result of a single ICMP roundtrip.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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