maclookup

package
v0.0.0-...-7e410e6 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SIOCETHTOOL       = 0x8946
	ETHTOOL_GPERMADDR = 0x20
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MacLookup

type MacLookup struct {
	sync.Mutex
	// contains filtered or unexported fields
}

MacLookup : lookup network interface by its (permanent) MAC address. Information about network interfaces is cached. Call RefreshCache() to flush and reload the cache content.

func (*MacLookup) GetInterfaceByIndex

func (m *MacLookup) GetInterfaceByIndex(ifIndex int) (netIf NetIf, found bool)

GetInterfaceByIndex : get network interface by its index (Linux kernel interface handle).

func (*MacLookup) GetInterfaceByMAC

func (m *MacLookup) GetInterfaceByMAC(mac net.HardwareAddr, prefix bool) (
	netIf NetIf, found bool)

GetInterfaceByMAC : lookup network interface by its MAC address.

func (*MacLookup) RefreshCache

func (m *MacLookup) RefreshCache()

RefreshCache should be called initially and when the cached data are suspected to be stale.

type NetIf

type NetIf struct {
	IfIndex int
	IfName  string
	MAC     net.HardwareAddr
}

NetIf : network interface.

Jump to

Keyboard shortcuts

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