Documentation ¶
Overview ¶
package macaddr 解析和反解析MAC地址,下一个MAC地址……
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Zero = MAC{0x0, 0x0, 0x0, 0x0, 0x0, 0x0} Bcast = MAC{0xff, 0xff, 0xff, 0xff, 0xff, 0xff} )
Functions ¶
This section is empty.
Types ¶
type MAC ¶
type MAC net.HardwareAddr
MAC 包装标准库的 net.HardwareAddr 类型 只支持 IEEE 802 MAC-48
func NewFromMCastIP4 ¶
NewFromMCastIP4 根据组播 IPv4 创建一个开头为 0x01005e 的组播地址
func NewFromMCastIP6 ¶
NewFromMCastIP6 根据组播 IPv4 创建一个开头为 0x3333 的组播地址
func Parse ¶
Parse 解析字符串为MAC 使用以下格式之一:
00:00:5e:00:53:01 00-00-5e-00-53-01 0000.5e00.5301 0000-5e00-5301 00005e005301
func (MAC) MarshalJSON ¶
MarshalJSON implements the interface MarshalJSON for json.Marshal.
func (MAC) ToCiscoStyle ¶
ToCiscoStyle 格式化为 xxxx.xxxx.xxxx 风格的字符串
func (MAC) ToHuaweiStyle ¶
ToHuaweiStyle 格式化为 xxxx-xxxx-xxxx 风格的字符串
func (MAC) UnmarshalJSON ¶
UnmarshalJSON implements the interface UnmarshalJSON for json.Unmarshal.
Click to show internal directories.
Click to hide internal directories.