icmp

package
v1.4.4-beta3 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2025 License: AGPL-3.0, Apache-2.0, MIT, + 1 more Imports: 19 Imported by: 0

Documentation

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
}

func NewClient

func NewClient(
	s *stack.Stack,
) *Client

func (*Client) Ping

func (c *Client) Ping(ctx context.Context, target string, connectTimeout time.Duration) (*Result, error)

func (*Client) PingScan

func (c *Client) PingScan(ctx context.Context, target string, opts ...ScanConfigOpt) (chan *Result, error)

func (*Client) PingV4

func (c *Client) PingV4(ctx context.Context, target string, timeout time.Duration) (*Result, error)

type Result

type Result struct {
	MessageCode byte
	MessageType byte
	Address     tcpip.Address
	TTL         uint8
	Ok          bool
	RTT         time.Duration
}

type ScanConfig

type ScanConfig struct {
	LinkAddressResolveTimeout time.Duration // link address resolve just for ping, default 4s

	Timeout    time.Duration // one target timeout, include link address resolve. default pingTimeout + 4s
	RetryTimes int
	Concurrent int
}

type ScanConfigOpt

type ScanConfigOpt func(*ScanConfig)

func WithConcurrent

func WithConcurrent(concurrent int) ScanConfigOpt

func WithLinkResolveTimeout

func WithLinkResolveTimeout(timeout time.Duration) ScanConfigOpt

func WithRetryTimes

func WithRetryTimes(times int) ScanConfigOpt

func WithTimeout

func WithTimeout(timeout time.Duration) ScanConfigOpt

Jump to

Keyboard shortcuts

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