netaddr

package
v0.0.0-...-eb2a3b3 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: BSD-3-Clause Imports: 6 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IPAdd

func IPAdd(ip net.IP, offset int) net.IP

IPAdd adds offset to ip

func IPMod

func IPMod(ip net.IP, d uint) uint

IPMod calculates ip % d

func IPSub

func IPSub(a, b net.IP) (d int, ok bool)

IPSub calculates d that fulfills the condition: IPAdd(a, d) == b. It returns ok == false if d does not fit into int32. BUG: does not handle circular proprty in case of IPv6.

func IsIPv4

func IsIPv4(ip net.IP) bool

IsIPv4 returns true if ip is IPv4 address.

Types

type MAC

type MAC uint64

func ParseMAC

func ParseMAC(s string) MAC

ParseMAC returns 0 MAC if error

func (MAC) CiscoString

func (m MAC) CiscoString() string

CiscoString return string representation of m in form hhhh.hhhh.hhhh, where h is hexadecimal digit: 0-9,a-f

func (MAC) ColonString

func (m MAC) ColonString() string

ColonString return string representation of m in form hh:hh:hh:hh:hh:hh, where h is hexadecimal digit: 0-9,a-f

func (MAC) PlainString

func (m MAC) PlainString() string

PlainString return string representation of m in form hhhhhhhhhhhh, where h is hexadecimal digit: 0-9,a-f

func (MAC) String

func (m MAC) String() string

String return string representation of m in form hh-hh-hh-hh-hh-hh, where h is hexadecimal digit: 0-9,a-f

Jump to

Keyboard shortcuts

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