macaddr

package
v0.423.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package macaddr classifies an IEEE 802 MAC address (EUI-48) from its two administration bits — the I/G bit (individual vs group/multicast) and the U/L bit (universally vs locally administered). The U/L bit is the standard signal that an address is locally administered, which on a unicast address is the hallmark of a randomized / privacy MAC (modern iOS, Android, Windows and Linux randomize the client MAC, setting this bit). It is the offline analysis complement to the WiFi/BLE scan tooling, whose results are lists of MACs.

Wrap-vs-native judgement

Native. The classification is two bit tests on the first octet plus an all-ones broadcast check — the IEEE 802 address-format rules, fixed and unambiguous. There is nothing to wrap.

Verifiable / no confidently-wrong output

The I/G and U/L bits have exact, universally-agreed definitions, so the multicast / locally-administered / broadcast determinations are facts, not guesses. The "randomized MAC" reading is framed as an observation (a locally-administered unicast address is *commonly* a randomized/privacy MAC), not a verdict — a device can be locally administered for other reasons. The OUI (first three octets) is surfaced raw and only when the address is universally administered (a locally-administered address has no meaningful OUI); the full IEEE OUI-to-vendor registry is large and not embedded here, so a vendor name is not guessed at this layer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	MAC                     string   `json:"mac"` // normalised AA:BB:CC:DD:EE:FF
	Unicast                 bool     `json:"unicast"`
	Multicast               bool     `json:"multicast"`
	Broadcast               bool     `json:"broadcast"`
	LocallyAdministered     bool     `json:"locally_administered"`
	UniversallyAdministered bool     `json:"universally_administered"`
	OUI                     string   `json:"oui,omitempty"` // first 3 octets, only when universally administered
	RandomizedLikely        bool     `json:"randomized_likely"`
	Notes                   []string `json:"notes,omitempty"`
}

Result is the structural classification of a MAC address.

func Classify

func Classify(raw string) (*Result, error)

Classify parses a MAC address (accepting ':' / '-' / '.' / no separators) and reports its IEEE 802 administration bits.

Jump to

Keyboard shortcuts

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