vendor

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Describe added in v0.1.4

func Describe(db DB, mac string) string

Describe returns a human-readable vendor string, falling back to an explanation when no vendor can exist rather than an empty value.

func Lookup

func Lookup(db DB, mac string, fallback string) string

Types

type DB

type DB map[string]string

func LoadDefault

func LoadDefault() DB

LoadDefault returns the OUI database, preferring (in order): a user override at ~/.ndscan/oui.txt, nmap's bundled prefix file, then a tiny built-in sample. The parser handles both "AABBCC Vendor" and "AA:BB:CC\tVendor" forms.

type MACKind added in v0.1.4

type MACKind string

MACKind classifies a hardware address, so callers can explain *why* a vendor lookup came back empty instead of leaving a blank field.

const (
	// KindGlobal is a real, IEEE-assigned address: the OUI identifies a vendor.
	KindGlobal MACKind = "global"
	// KindRandomized is a locally-administered address. Modern phones and
	// laptops randomize their MAC per network for privacy, so no vendor exists
	// to look up — an empty vendor here is correct, not a failed lookup.
	KindRandomized MACKind = "randomized"
	// KindMulticast is a group address, not a host.
	KindMulticast MACKind = "multicast"
	// KindUnknown means the value didn't parse as a MAC.
	KindUnknown MACKind = ""
)

func Classify added in v0.1.4

func Classify(mac string) MACKind

Classify inspects the two flag bits in the first octet of a MAC address.

Bit 0 marks a multicast/group address; bit 1 marks a locally-administered one. Randomized privacy addresses set bit 1, which is why they never match an OUI: the IEEE never assigned them to anybody.

Jump to

Keyboard shortcuts

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