icmp

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2016 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package icmp provides icmp enhanced methods based on the golang icmp package

Index

Constants

View Source
const (
	ProtocolIPv4ICMP = 1  // IANA ICMP for IPv4
	ProtocolIPv6ICMP = 58 // IANA ICMP for IPv6
)

IANA ICMP

Variables

This section is empty.

Functions

func IsIPv4 added in v0.1.9

func IsIPv4(ip net.IP) bool

IsIPv4 returns true if ip version is v4

func IsIPv6 added in v0.1.9

func IsIPv6(ip net.IP) bool

IsIPv6 returns true if ip version is v6

Types

type Ping

type Ping struct {
	MaxRTT time.Duration
	// contains filtered or unexported fields
}

Ping represents ping request

func NewPing

func NewPing(args string) (*Ping, error)

NewPing creates a new ping object

func (*Ping) DelIP

func (p *Ping) DelIP(ipAddr string)

DelIP removes ip adrress

func (*Ping) PacketSize

func (p *Ping) PacketSize(s int)

PacketSize set packet size

func (*Ping) Ping

func (p *Ping) Ping(out chan Response)

Ping tries to send and receive a packet

func (*Ping) Run added in v0.1.9

func (p *Ping) Run() chan Response

Run loops the ping and print it out

func (*Ping) SetIP added in v0.1.9

func (p *Ping) SetIP(ipAddr string)

SetIP set ip address

type Response added in v0.1.9

type Response struct {
	RTT      float64
	Size     int
	Sequence int
	Addr     string
	Timeout  bool
	Error    error
}

Result represent ping response

type Trace

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

Trace represents trace properties

func (*Trace) Bind

func (i *Trace) Bind() int

Bind starts to listen for ICMP reply

func (*Trace) Done

func (i *Trace) Done(fd int)

Done close the socket

func (*Trace) Init

func (i *Trace) Init(dest string, timeout int64)

Init set the basic parameters

func (*Trace) Recv

func (i *Trace) Recv(fd int) (int, int, string)

Recv gets the replied icmp packet

func (*Trace) Run

func (i *Trace) Run(ip string)

Run provides trace based on the other methods

func (*Trace) Send

func (i *Trace) Send() error

Send tries to send an UDP packet

func (*Trace) SetTTL

func (i *Trace) SetTTL(ttl int)

SetTTL set the IP packat time to live

Jump to

Keyboard shortcuts

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