Documentation
¶
Overview ¶
Package macaddr validates MAC-48 addresses.
Index ¶
Constants ¶
View Source
const ( // MinVLAN is the minimum VLAN number. MinVLAN = 0x001 // MaxVLAN is the maximum VLAN number. MaxVLAN = 0xFFE )
Variables ¶
View Source
var ( ErrAddr = errors.New("invalid MAC address") ErrUnicast = errors.New("invalid unicast MAC address") ErrMulticast = errors.New("invalid multicast MAC address") ErrVLAN = errors.New("invalid VLAN") )
Error conditions.
Functions ¶
func IsMulticast ¶
func IsMulticast(a net.HardwareAddr) bool
IsMulticast determines whether the HardwareAddr is a multicast MAC-48 address.
func IsUnicast ¶
func IsUnicast(a net.HardwareAddr) bool
IsUnicast determines whether the HardwareAddr is a non-zero unicast MAC-48 address.
func MakeRandomUnicast ¶
func MakeRandomUnicast() (a net.HardwareAddr)
MakeRandomUnicast generates a random unicast MAC-48 address.
Types ¶
type Flag ¶
type Flag struct {
net.HardwareAddr
}
Flag is a wrapper of net.HardwareAddr compatible with flag and json packages.
func (Flag) MarshalText ¶
MarshalText implements encoding.TextMarshaler.
func (*Flag) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler.
Click to show internal directories.
Click to hide internal directories.