Documentation ¶
Index ¶
- Variables
- func FormatMacAddr(macAddr string) string
- func IP2Number(ipstr string) (uint32, error)
- func IsExitAddress(addr IPV4Addr) bool
- func IsHostLocal(addr IPV4Addr) bool
- func IsLinkLocal(addr IPV4Addr) bool
- func IsMulticast(addr IPV4Addr) bool
- func IsPrivate(addr IPV4Addr) bool
- func MacUnpackHex(mac string) string
- func Mask2Len(mask IPV4Addr) int8
- func Number2Bytes(num uint32) []byte
- func Number2IP(num uint32) string
- func SetPrivatePrefixes(pref []string)
- type IPV4Addr
- func (addr IPV4Addr) BroadcastAddr(maskLen int8) IPV4Addr
- func (addr IPV4Addr) CliAddr(maskLen int8) IPV4Addr
- func (addr IPV4Addr) NetAddr(maskLen int8) IPV4Addr
- func (addr IPV4Addr) StepDown() IPV4Addr
- func (addr IPV4Addr) StepUp() IPV4Addr
- func (addr IPV4Addr) String() string
- func (addr IPV4Addr) ToBytes() []byte
- func (addr IPV4Addr) ToMac(prefix string) string
- type IPV4AddrRange
- func (ar IPV4AddrRange) AddressCount() int
- func (ar IPV4AddrRange) Contains(ip IPV4Addr) bool
- func (ar IPV4AddrRange) ContainsRange(ar2 IPV4AddrRange) bool
- func (ar IPV4AddrRange) EndIp() IPV4Addr
- func (ar IPV4AddrRange) IsOverlap(ar2 IPV4AddrRange) bool
- func (ar IPV4AddrRange) Merge(ar2 IPV4AddrRange) (*IPV4AddrRange, bool)
- func (ar IPV4AddrRange) Random() IPV4Addr
- func (ar IPV4AddrRange) StartIp() IPV4Addr
- func (ar IPV4AddrRange) String() string
- func (ar IPV4AddrRange) Substract(ar2 IPV4AddrRange) (lefts []IPV4AddrRange, sub *IPV4AddrRange)
- func (ar IPV4AddrRange) ToIPNets() []*net.IPNet
- func (ar IPV4AddrRange) ToMaskMatches() [][2]uint32
- type IPV4Prefix
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FormatMacAddr ¶
func IsExitAddress ¶
func IsHostLocal ¶
func IsLinkLocal ¶
func IsMulticast ¶
func MacUnpackHex ¶
func Number2Bytes ¶
func SetPrivatePrefixes ¶
func SetPrivatePrefixes(pref []string)
Types ¶
type IPV4Addr ¶
type IPV4Addr uint32
func Masklen2Mask ¶
func NewIPV4Addr ¶
func (IPV4Addr) BroadcastAddr ¶
type IPV4AddrRange ¶
type IPV4AddrRange struct {
// contains filtered or unexported fields
}
func GetPrivateIPRanges ¶
func GetPrivateIPRanges() []IPV4AddrRange
func NewIPV4AddrRange ¶
func NewIPV4AddrRange(ip1 IPV4Addr, ip2 IPV4Addr) IPV4AddrRange
func NewIPV4AddrRangeFromIPNet ¶
func NewIPV4AddrRangeFromIPNet(n *net.IPNet) IPV4AddrRange
n.IP and n.Mask must be ipv4 type. n.Mask must be canonical
func (IPV4AddrRange) AddressCount ¶
func (ar IPV4AddrRange) AddressCount() int
func (IPV4AddrRange) Contains ¶
func (ar IPV4AddrRange) Contains(ip IPV4Addr) bool
func (IPV4AddrRange) ContainsRange ¶
func (ar IPV4AddrRange) ContainsRange(ar2 IPV4AddrRange) bool
func (IPV4AddrRange) EndIp ¶
func (ar IPV4AddrRange) EndIp() IPV4Addr
func (IPV4AddrRange) IsOverlap ¶
func (ar IPV4AddrRange) IsOverlap(ar2 IPV4AddrRange) bool
func (IPV4AddrRange) Merge ¶
func (ar IPV4AddrRange) Merge(ar2 IPV4AddrRange) (*IPV4AddrRange, bool)
func (IPV4AddrRange) Random ¶
func (ar IPV4AddrRange) Random() IPV4Addr
func (IPV4AddrRange) StartIp ¶
func (ar IPV4AddrRange) StartIp() IPV4Addr
func (IPV4AddrRange) String ¶
func (ar IPV4AddrRange) String() string
func (IPV4AddrRange) Substract ¶
func (ar IPV4AddrRange) Substract(ar2 IPV4AddrRange) (lefts []IPV4AddrRange, sub *IPV4AddrRange)
func (IPV4AddrRange) ToIPNets ¶
func (ar IPV4AddrRange) ToIPNets() []*net.IPNet
func (IPV4AddrRange) ToMaskMatches ¶
func (ar IPV4AddrRange) ToMaskMatches() [][2]uint32
type IPV4Prefix ¶
func NewIPV4Prefix ¶
func NewIPV4Prefix(prefix string) (IPV4Prefix, error)
func (IPV4Prefix) Contains ¶
func (prefix IPV4Prefix) Contains(ip IPV4Addr) bool
func (*IPV4Prefix) Equals ¶
func (pref *IPV4Prefix) Equals(pref1 *IPV4Prefix) bool
func (*IPV4Prefix) String ¶
func (pref *IPV4Prefix) String() string
func (IPV4Prefix) ToIPRange ¶
func (prefix IPV4Prefix) ToIPRange() IPV4AddrRange
Click to show internal directories.
Click to hide internal directories.