arping

package
v0.0.0-...-683b059 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2022 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package arping contains utility functions to wrap around the arping program.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*config)

Option is a function to configure arping command.

func Count

func Count(count int) Option

Count returns an option that sets the packets count arping should send.

func Timeout

func Timeout(timeout time.Duration) Option

Timeout returns an option that sets timeout of arping in seconds. Note that arping accepts only integer in seconds, so this option will truncate the parameter to second.

type Result

type Result struct {
	Sent          int
	Received      int
	Loss          float64
	AvgLatency    time.Duration
	ResponderIPs  []string
	ResponderMACs []string
	Latencies     []time.Duration
}

Result contains the sorted out output of arping command.

func (*Result) String

func (r *Result) String() string

String returns a overview of the Result.

type Runner

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

Runner is the object contains arping utilities.

func NewRunner

func NewRunner(c cmd.Runner) *Runner

NewRunner creates a new arping command utility runner.

func (*Runner) Arping

func (r *Runner) Arping(ctx context.Context, targetIP, iface string, ops ...Option) (*Result, error)

Arping performs an arping from the specified interface to the target IP with the options. By default 10 packets will be sent and the timeout will be the same as the count in seconds. It sends only broadcast ARPs.

Jump to

Keyboard shortcuts

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