macaddr

package
v0.0.0-...-1e60831 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: NIST-PD-fallback Imports: 5 Imported by: 3

Documentation

Overview

Package macaddr validates MAC-48 addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b net.HardwareAddr) bool

Equal determines whether two HardwareAddrs are the same.

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) Empty

func (f Flag) Empty() bool

Empty returns true if the HardwareAddr is unset.

func (*Flag) Get

func (f *Flag) Get() any

Get implements flag.Getter.

func (Flag) MarshalText

func (f Flag) MarshalText() (text []byte, e error)

MarshalText implements encoding.TextMarshaler.

func (*Flag) Set

func (f *Flag) Set(s string) (e error)

Set implements flag.Value.

func (*Flag) UnmarshalText

func (f *Flag) UnmarshalText(text []byte) (e error)

UnmarshalText implements encoding.TextUnmarshaler.

Jump to

Keyboard shortcuts

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