Beispiel #1
0
// Example of opening a database
func main() {
	// Load the content from "sampledb.txt" into a static database
	db, err := oui.OpenStaticFile("sampledb.txt")
	if err != nil {
		panic(err)
	}

	oui.PrintDb(db)
}
Beispiel #2
0
// Example of querying a database
func main() {
	// Load the content from "sampledb.txt" into a static database
	db, err := oui.OpenStaticFile("sampledb.txt")
	if err != nil {
		panic(err)
	}

	// Query on text string
	entry, err := db.Query("00-60-93-98-02-01")
	if err == oui.ErrNotFound {
		fmt.Println("Not found")
	} else if err != nil {
		panic(err)
	} else {
		fmt.Println(entry.String())
	}
}
Beispiel #3
0
// Example of looking up with byte values
func main() {
	// Load the content from "sampledb.txt" into a static database
	db, err := oui.OpenStaticFile("sampledb.txt")
	if err != nil {
		panic(err)
	}

	// We create a hardware address with the values we would like to look up:
	hw := oui.HardwareAddr{0x00, 0x60, 0x92}

	// Now we look up
	entry, err := db.LookUp(hw)
	if err == oui.ErrNotFound {
		fmt.Println("Not found")
	} else if err != nil {
		panic(err)
	} else {
		fmt.Println(entry.String())
	}
}