arpdb

package
v0.108.0-b.55 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package arpdb implements the Network Neighborhood Database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct{}

Empty is the Interface implementation that does nothing.

func (Empty) Neighbors

func (Empty) Neighbors() (ns []Neighbor)

Neighbors implements the Interface interface for EmptyARPContainer. It always returns nil.

func (Empty) Refresh

func (Empty) Refresh() (err error)

Refresh implements the Interface interface for EmptyARPContainer. It does nothing and always returns nil error.

type Interface

type Interface interface {
	// Refresh updates the stored data.  It must be safe for concurrent use.
	Refresh() (err error)

	// Neighbors returnes the last set of data reported by ARP.  Both the method
	// and it's result must be safe for concurrent use.
	Neighbors() (ns []Neighbor)
}

Interface stores and refreshes the network neighborhood reported by ARP (Address Resolution Protocol).

func New

func New() (arp Interface)

New returns the Interface properly initialized for the OS.

type Neighbor

type Neighbor struct {
	// Name is the hostname of the neighbor.  Empty name is valid since not each
	// implementation of ARP is able to retrieve that.
	Name string

	// IP contains either IPv4 or IPv6.
	IP netip.Addr

	// MAC contains the hardware address.
	MAC net.HardwareAddr
}

Neighbor is the pair of IP address and MAC address reported by ARP.

func (Neighbor) Clone

func (n Neighbor) Clone() (clone Neighbor)

Clone returns the deep copy of n.

Jump to

Keyboard shortcuts

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