internal

package
v2.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProtocolICMP is the number of the Internet Control Message Protocol
	// (see golang.org/x/net/internal/iana.ProtocolICMP)
	ProtocolICMP = 1

	// ProtocolICMPv6 is the IPv6 Next Header value for ICMPv6
	// see golang.org/x/net/internal/iana.ProtocolIPv6ICMP
	ProtocolICMPv6 = 58
)

Variables

View Source
var (
	Logger = &logwrap.Instance{}

	// SetLogger allows updating the Logger. For details, see
	// "github.com/digineo/go-logwrap".Instance.SetLogger.
	SetLogger = Logger.SetLogger
)

Functions

This section is empty.

Types

type Conn

type Conn struct {
	Receiver   Receiver
	Privileged bool
	// contains filtered or unexported fields
}

func (*Conn) Close

func (c *Conn) Close()

func (*Conn) Open

func (c *Conn) Open(bind4, bind6 string) error

New creates a new Pinger. This will open the raw socket and start the receiving logic. You'll need to call Close() to cleanup.

func (*Conn) WriteTo

func (c *Conn) WriteTo(addr *net.IPAddr, seq int, data []byte) error

sendRequest marshals the payload and sends the packet. It returns the sequence number and an error if the sending failed.

type Payload

type Payload []byte

Payload represents additional data appended to outgoing ICMP Echo Requests.

func (*Payload) Resize

func (p *Payload) Resize(size uint16)

Resize will assign a new payload of the given size to p.

type Receiver

type Receiver func(body *icmp.Echo, icmpError error, addr net.IPAddr, tRecv *time.Time)

Jump to

Keyboard shortcuts

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