Documentation ¶
Overview ¶
Package addrs contains helpers for ip and mac address conversion.
Index ¶
- func DiffAddr(newConfig []*net.IPNet, oldConfig []*net.IPNet) (toBeDeleted []*net.IPNet, toBeAdded []*net.IPNet)
- func IsIPv6(addr string) (bool, error)
- func MacIntToString(macInt uint64) string
- func ParseIPWithPrefix(input string) (addr *net.IPNet, isIpv6 bool, err error)
- func StrAddrsToStruct(addrs []string) ([]*net.IPNet, error)
- type SortedIPs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffAddr ¶
func DiffAddr(newConfig []*net.IPNet, oldConfig []*net.IPNet) (toBeDeleted []*net.IPNet, toBeAdded []*net.IPNet)
DiffAddr calculates the difference between two slices of AddrWithPrefix configuration. Returns a list of addresses that should be deleted and added to the current configuration to match newConfig.
func MacIntToString ¶
MacIntToString converts MAC address string representation xx:xx:xx:xx:xx:xx
func ParseIPWithPrefix ¶
ParseIPWithPrefix parses string representation of ip address into net.IPNet structure. If the prefix is missing default one is added (/32 for IPv4, /128 for IPv6)
Types ¶
type SortedIPs ¶
SortedIPs type is used to implement sort.Interface for slice of IPNet
Click to show internal directories.
Click to hide internal directories.