formac

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatBare

func FormatBare(hwaddr net.HardwareAddr) string

FormatBare takes a net.HardwareAddress and returns a "bare" MAC address, i.e. capital hex characters only with no delimiters.

func FormatCisco

func FormatCisco(hwaddr net.HardwareAddr) string

FormatCisco takes a net.HardwareAddress and returns a Cisco-formatted MAC address.

func FormatEUI

func FormatEUI(hwaddr net.HardwareAddr) string

FormatEUI takes a net.HardwareAddress and returns an EUI-formatted MAC address, i.e. capital hex characters with hyphen ("-") separating each byte's worth of hex characters.

func FormatPgSQL

func FormatPgSQL(hwaddr net.HardwareAddr) string

FormatPgSQL takes a net.HardwareAddress and returns a PostgresQL-formatted MAC address.

func FormatUnixCompact

func FormatUnixCompact(hwaddr net.HardwareAddr) string

FormatUnixCompact takes a net.HardwareAddress and returns a Unix-formatted MAC address with extraneous zeroes ("0") stripped.

func FormatUnixExpanded

func FormatUnixExpanded(hwaddr net.HardwareAddr) string

FormatUnixExpanded takes a net.HardwareAddress and returns a Unix-formatted MAC address.

func GetFormatted

func GetFormatted(mac, format string) (string, error)

GetFormatted takes a MAC address and output format as strings and returns the MAC address in various vendor formats in the requested output formats. Currently supports 'plain' and 'json' output formats. Outputs 'plain' by default.

func GetJSON

func GetJSON(mac string) (string, error)

GetJSON takes a MAC address string and returns a non-prettified (single-line) JSON string of that MAC address in common formats. This *could* be implemented as JSON() method on the internal macStruct type, but we want that type to remain internal but have a public way to return the plaintext representation.

func GetManufacturer added in v0.3.0

func GetManufacturer(mac net.HardwareAddr) string

GetManufacturer takes a net.HardwareAddr and returns the manufacturer to whom that MAC address is registered.

func GetPlain

func GetPlain(mac string) (string, error)

GetPlain takes a MAC address string and returns a multi-line, plaintext string of that MAC address in common formats.

Types

This section is empty.

Jump to

Keyboard shortcuts

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