macLookup

package
v0.0.0-...-7b93b34 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package macLookup provides a wrapper around the vendor lookup API of 'https://macvendors.co'

Index

Constants

This section is empty.

Variables

View Source
var MACFormatError = errors.New("invalid mac format. Supported formats hex ':' bit '-' dot '.'")

MACFormatError is returned if the provided MAC-address is an unsupported format.

Functions

This section is empty.

Types

type Vendor

type Vendor struct {
	// Address is the postal address of the vendor
	Address string `json:"address"`

	// Company is the company name of the vendor.
	Company string `json:"company"`

	// Country is the country in which the vendor operates.
	Country string `json:"country"`

	// Type is the address block type of the vendor.
	Type string `json:"type"`

	// MacPrefix is the vendor specific MAC-prefix.
	MacPrefix string `json:"mac_prefix"`

	// StartHex is the first address of the vendor prefix.
	StartHex string `json:"start_hex"`

	//EndHex is the last address of the vendor prefix.
	EndHex string `json:"end_hex"`
}

Vendor represents a single device manufacturer.

type VendorResult

type VendorResult struct {
	*Vendor `json:"result"`
}

VendorResult represents a result returned from the API.

func LookupVendor

func LookupVendor(hardwareAddr net.HardwareAddr) (*VendorResult, error)

LookupVendor tries to look up the vendor of hardwareAddr by sending a HTTP-request to the API of 'http://macvendors.co/' and if successful returns a pointer to the VendorResult.

Jump to

Keyboard shortcuts

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