mac

package
v0.8.8 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateMAC

func GenerateMAC() net.HardwareAddr

GenerateMAC will generate MAC addresses with fixed first 24 bits (CNI OUI), and the last 24 bits will be random, so there are at most 16777216(2^24) different addresses. To avoid MAC address collision as much as possible, this function is suggested to be used within the limitation that each subnet should contain no more 1024(2^10) using IP addresses. For example, a subnet whose prefix is greater or equal than 22 is safe to use this function as MAC address generator.

func NormalizeMAC added in v0.7.0

func NormalizeMAC(mac string) string

NormalizeMAC returns a well formatted hardware address string if mac is valid, or an empty string if not.

Types

This section is empty.

Jump to

Keyboard shortcuts

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