ouidb

package module
v0.0.0-...-03199db Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2017 License: MIT Imports: 7 Imported by: 0

README

go-ouitools

Golang tools to work with Mac addresses and oui. Includes oui database to resolve to vendor.

Sample

package main

import (
	"fmt"
	"os"

	"github.com/davidbb/ouidb"
)

var (
    db *ouidb.OuiDB
)

func main() {
	db = ouidb.New("oui.txt")
	if db == nil {
		fmt.Println("database not initialized")
		os.Exit(1)
	}
  
	mac := "00:16:e0:3d:f4:4c"
	v, err := db.Lookup(mac)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	}
	
	fmt.Printf("%s => %s\n", mac, v)
}

Testing

go test

References

  • wireshark oui database

Contributors

  • Remco Verhoef (Dutchcoders) @remco_verhoef
  • Claudio Matsuoka
  • David Barrera

Documentation

Overview

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

This section is empty.

Types

type OuiDB

type OuiDB struct {
	// contains filtered or unexported fields
}

func New

func New(file string) *OuiDB

New returns a new OUI database loaded from the specified file.

func (*OuiDB) Lookup

func (m *OuiDB) Lookup(s string) (string, error)

Lookup obtains the vendor organization name from the MAC address s.

Jump to

Keyboard shortcuts

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