icmp

package
v0.0.0-...-4b0016b Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ICMPv4 = 1
	ICMPv6 = 58
)

proto

Variables

This section is empty.

Functions

This section is empty.

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) Ping

func (i *ICMP) Ping(ctx context.Context, host string, opts ...Option) (*Statistics, error)

Ping without stdout

type Option

type Option func(*Options)

Option Options function

func Count

func Count(count int) Option

Count count

func Log

func Log(w io.Writer) Option

Log ..

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 {
	Log io.Writer
	// 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 ..

func (*Statistics) Print

func (stats *Statistics) Print() string

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