A Go module that provides methods to lookup the Vendor string of an Organizationally Unique Identifier. For Ethernet MACs the OUI is encoded in the first 24 bits.
Vendor lookup is done statically using generated code. Code is generated based in the IEEE registration database.
package main
import (
"fmt"
"net"
"github.com/endobit/oui"
)
func main() {
const addr = "00:00:0f:01:02:03"
// Lookup the vendor of an Ethernet MAC.
fmt.Println(oui.Vendor(addr))
// Or, lookup the vendor of a net.HardwareAddr.
mac, err := net.ParseMAC(addr)
if err != nil {
fmt.Println("%q not a mac", addr)
panic(err)
}
fmt.Println(oui.VendorFromMAC(mac))
}
This package uses mage.
Type mage
for a list of targets. mage build
will regenerate the static OUI
data.