icmp

package
v0.0.0-...-f4dfc87 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

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

func NewConn

func NewConn(protoName string, target string, id int) (*Conn, error)

NOTE: for unprivileged ICMP sockets, the given id will always be ignored, since the kernel assigns an ID..

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) ID

func (c *Conn) ID() int

func (*Conn) Recv

func (c *Conn) Recv() (ping Ping, err error)

Receive ICMP Echo Response.

func (*Conn) Send

func (c *Conn) Send(ping *Ping) error

Send ICMP Echo Request using given parameters.

Updates ping.ID and ping.Time when sending.

func (*Conn) String

func (c *Conn) String() string

func (*Conn) Write

func (c *Conn) Write(wm icmp.Message) error

type Ping

type Ping struct {
	Time time.Time
	IP   net.IP
	ID   uint16
	Seq  uint16
	Data []byte
}

ICMP Echo Request/Response info

type PingConfig

type PingConfig struct {
	Target   string        `json:"target" long:"target"`
	Proto    string        `json:"proto" long:"protocol" value-name:"ipv4|ipv6" default:"ipv4"`
	ID       int           `json:"id" long:"id"`
	Interval time.Duration `json:"interval" long:"interval" value-name:"<count>(ns|us|ms|s|m|h)" default:"1s"`
}

func (PingConfig) Worker

func (self PingConfig) Worker() (worker.Worker, error)

type PingStats

type PingStats struct {
	ID       int
	SendTime time.Time // ping request was sent out
	RecvTime time.Time
}

func (PingStats) RTT

func (self PingStats) RTT() time.Duration

func (PingStats) StatsFields

func (self PingStats) StatsFields() map[string]interface{}

func (PingStats) StatsID

func (self PingStats) StatsID() stats.ID

func (PingStats) StatsTime

func (self PingStats) StatsTime() time.Time

func (PingStats) String

func (self PingStats) String() string

type Pinger

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

func NewPinger

func NewPinger(config PingConfig) (*Pinger, error)

func (*Pinger) Config

func (p *Pinger) Config() config.Config

func (*Pinger) ConfigSub

func (p *Pinger) ConfigSub(configSub *config.Sub) error

func (*Pinger) Run

func (p *Pinger) Run() error

mainloop

func (*Pinger) StatsWriter

func (p *Pinger) StatsWriter(statsWriter *stats.Writer) error

func (*Pinger) Stop

func (p *Pinger) Stop()

func (*Pinger) String

func (p *Pinger) String() string

Jump to

Keyboard shortcuts

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