icmp

package
v0.0.0-...-3d49d55 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ICMPv4 = 1
	ICMPv6 = 58
)

proto

Variables

This section is empty.

Functions

func Lookup

func Lookup(host string) (string, error)

Lookup DNS

Types

type EchoStat

type EchoStat struct {
	Seq  int
	TTL  int
	Cost time.Duration
}

EchoStat echo reply stat

type ICMP

type ICMP struct {
	ID int
	// contains filtered or unexported fields
}

ICMP icmp config

func New

func New(opts ...Option) *ICMP

New ping

func (*ICMP) Echo

func (i *ICMP) Echo(ctx context.Context, addr string) (*EchoStat, error)

Echo send one icmp packet

func (*ICMP) Ping

func (i *ICMP) Ping(ctx context.Context, host string)

Ping ping

func (*ICMP) Send

func (i *ICMP) Send(ctx context.Context, host string) (Statistics, error)

Send without stdout

type Option

type Option func(*Options)

Option Options function

func Count

func Count(count int) Option

Count count

func Size

func Size(size int) Option

Size set size

func Timeout

func Timeout(timeout time.Duration) Option

Timeout set timeout

type Options

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

Options options

type Statistics

type Statistics struct {
	Host        string
	Transmitted int
	Received    int
	Loss        float64
	Time        time.Duration
	TimeExp2    int64
	// contains filtered or unexported fields
}

Statistics Statistics

func (Statistics) Print

func (stats Statistics) Print(w io.Writer)

Print print

func (Statistics) String

func (stats Statistics) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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