Documentation ¶
Overview ¶
Updated version of https://github.com/dutchcoders/go-ouitools Package go-oui provides functions to work with MAC and OUI's
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidMACAddress = errors.New("invalid MAC address")
Functions ¶
Types ¶
type AddressBlock ¶
type AddressBlock struct { Oui HardwareAddr Mask int Organization string }
oui, mask, organization
func (*AddressBlock) Contains ¶
func (b *AddressBlock) Contains(address HardwareAddr) bool
Contains reports whether the mac address belongs to the OUI
type HardwareAddr ¶
type HardwareAddr net.HardwareAddr
func ParseOUI ¶
func ParseOUI(s string, size int) (hw HardwareAddr, err error)
ParseMAC parses s as an IEEE 802 MAC-48, EUI-48, or EUI-64 using one of the following formats:
01:23:45:67:89:ab 01:23:45:67:89:ab:cd:ef 01-23-45-67-89-ab 01-23-45-67-89-ab-cd-ef 0123.4567.89ab 0123.4567.89ab.cdef
func (HardwareAddr) Mask ¶
func (address HardwareAddr) Mask(mask []byte) []byte
Mask returns the result of masking the address with mask.
type OuiDb ¶
type OuiDb struct {
Blocks []AddressBlock
}
func (*OuiDb) Lookup ¶
func (m *OuiDb) Lookup(address HardwareAddr) *AddressBlock
Lookup finds the OUI the address belongs to
func (*OuiDb) LookupString ¶
func (m *OuiDb) LookupString(s string) (*AddressBlock, error)
VendorLookup obtains the vendor organization name from the MAC address s.
Click to show internal directories.
Click to hide internal directories.