icmp

package
v1.3.9-beta5 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: AGPL-3.0, Apache-2.0, MIT, + 1 more Imports: 17 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) PingScan

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

func (*Client) PingV4

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

type PingResult

type PingResult struct {
	MessageType header.ICMPv4Type
	MessageCode header.ICMPv4Code
	MessageID   uint16
	Address     tcpip.Address
	TTL         uint8
}

type ScanConfig

type ScanConfig struct {
	PingTimeout time.Duration // time out 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 WithPingTimeout

func WithPingTimeout(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