echo

package
v0.0.0-...-34b109a Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package echo implements an ICMPv4/6 echo client for performing ping operations on destination hosts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

A Client sends ICMPv4/6 echo requests to perform ping operations.

func NewClient

func NewClient(ifi *net.Interface) (*Client, error)

NewClient binds a Client on the specified network interface.

func (*Client) Close

func (ec *Client) Close() error

Close closes the Client's underlying network connections.

func (*Client) Ping

func (ec *Client) Ping(ctx context.Context, dst netip.Addr) (*Response, error)

Ping performs an ICMPv4/6 echo or "ping" on a target host.

type Response

type Response struct {
	// Duration reports how much time elapsed during the echo request and
	// response cycle.
	Duration time.Duration

	// Ping and Pong are the raw ICMP ping messages sent by the Client and
	// received from the target host.
	Ping, Pong *icmp.Echo

	// IP is the IPv4/6 address of the target host.
	IP netip.Addr
}

A Response is the result of a Client.Ping operation.

Jump to

Keyboard shortcuts

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