arping

package module
v0.0.0-...-f0fea2f Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: MIT Imports: 10 Imported by: 0

README

pkg.go.dev

arping-go

Originally forked from https://github.com/j-keck/arping. This fork supports returning multiple mac addresses for a single ip address.

arping is a native go library to ping a host per arp datagram, or query a host mac address.

The currently supported platforms are: Linux and BSD.

Usage

arping library
  • import this library per import "github.com/BirknerAlex/arping-go"
  • export GOPATH if not already (export GOPATH=$PWD)
  • download the library go get
  • run it sudo -E go run <YOUR PROGRAMM>
  • or build it go build

The library requires raw socket access. So it must run as root, or with appropriate capabilities under linux: sudo setcap cap_net_raw+ep <BIN>.

For api doc and examples see: godoc or check the standalone under 'cmd/arping/main.go'.

arping executable

To get a runnable pinger use go get -u github.com/BirknerAlex/arping-go/cmd/arping. This will build the binary in $GOPATH/bin.

arping requires raw socket access. So it must run as root, or with appropriate capabilities under Linux: sudo setcap cap_net_raw+ep <ARPING_PATH>.

Documentation

Overview

Package arping is a native go library to ping a host per arp datagram, or query a host mac address

The currently supported platforms are: Linux and BSD.

The library requires raw socket access. So it must run as root, or with appropriate capabilities under linux: `sudo setcap cap_net_raw+ep <BIN>`.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTimeout error
	ErrTimeout = errors.New("timeout")
)

Functions

func EnableVerboseLog

func EnableVerboseLog()

EnableVerboseLog enables verbose logging on stdout

func GratuitousArp

func GratuitousArp(srcIP net.IP) error

GratuitousArp sends an gratuitous arp from 'srcIP'

func GratuitousArpOverIface

func GratuitousArpOverIface(srcIP net.IP, iface net.Interface) error

GratuitousArpOverIface sends an gratuitous arp over interface 'iface' from 'srcIP'

func GratuitousArpOverIfaceByName

func GratuitousArpOverIfaceByName(srcIP net.IP, ifaceName string) error

GratuitousArpOverIfaceByName sends an gratuitous arp over interface name 'ifaceName' from 'srcIP'

func SetTimeout

func SetTimeout(t time.Duration)

SetTimeout sets ping timeout

Types

type LinuxSocket

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

type Result

type Result struct {
	HwAddr   net.HardwareAddr
	Duration time.Duration
}

func Ping

func Ping(dstIP net.IP) ([]Result, error)

Ping sends an arp ping to 'dstIP'

func PingOverIface

func PingOverIface(dstIP net.IP, iface net.Interface) ([]Result, error)

PingOverIface sends an arp ping over interface 'iface' to 'dstIP'

func PingOverIfaceByName

func PingOverIfaceByName(dstIP net.IP, ifaceName string) ([]Result, error)

PingOverIfaceByName sends an arp ping over interface name 'ifaceName' to 'dstIP'

Directories

Path Synopsis
cmd
arping
command line arping utility which use the 'arping' library
command line arping utility which use the 'arping' library

Jump to

Keyboard shortcuts

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