Documentation ¶
Index ¶
- func BigEndianToLocal(input []byte) []byte
- func Htons(x uint16) uint16
- func StrToAddr(x string) (uint32, error)
- type IP
- func IPFromBytes(b []byte) (IP, error)
- func IPFromProtoIP(addr *api.IP) *IP
- func IPFromString(str string) (IP, error)
- func IPv4(val uint32) IP
- func IPv4FromBytes(b []byte) IP
- func IPv4FromOctets(o1, o2, o3, o4 uint8) IP
- func IPv6(higher, lower uint64) IP
- func IPv6FromBlocks(b1, b2, b3, b4, b5, b6, b7, b8 uint16) IP
- func (ip *IP) BitAtPosition(pos uint8) bool
- func (ip *IP) Bytes() []byte
- func (ip *IP) Compare(other *IP) int8
- func (ip IP) Dedup() *IP
- func (ip *IP) Equal(other *IP) bool
- func (ip *IP) Higher() uint64
- func (ip *IP) IsIPv4() bool
- func (ip *IP) Lower() uint64
- func (ip *IP) MaskLastNBits(n uint8) *IP
- func (ip *IP) Next() *IP
- func (ip IP) Ptr() *IP
- func (ip *IP) SizeBytes() uint8
- func (ip *IP) String() string
- func (ip *IP) ToNetIP() net.IP
- func (ip IP) ToProto() *api.IP
- func (ip *IP) ToUint32() uint32
- type Prefix
- func (pfx *Prefix) Addr() *IP
- func (p *Prefix) BaseAddr() *IP
- func (pfx *Prefix) Contains(x *Prefix) bool
- func (p Prefix) Dedup() *Prefix
- func (pfx *Prefix) Equal(x *Prefix) bool
- func (pfx *Prefix) GetIPNet() *gonet.IPNet
- func (pfx *Prefix) GetSupernet(x *Prefix) Prefix
- func (pfx *Prefix) Pfxlen() uint8
- func (p Prefix) Ptr() *Prefix
- func (pfx *Prefix) String() string
- func (p Prefix) ToProto() *api.Prefix
- func (p *Prefix) Valid() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BigEndianToLocal ¶
BigEndianToLocal converts input from big endian to "local" endian
Types ¶
type IP ¶
type IP struct {
// contains filtered or unexported fields
}
IP represents an IPv4 or IPv6 address
func IPFromBytes ¶
IPFromBytes returns an IP address for a byte slice
func IPFromProtoIP ¶
IPFromProtoIP creates an IP address from a proto IP
func IPFromString ¶
IPFromString returns an IP address for a given string
func IPv4FromBytes ¶
IPv4FromBytes creates an IPv4 Address from one or more bytes. Missing bytes are filled with zero bytes.
func IPv4FromOctets ¶
IPv4FromOctets returns an IPv4 address for the given 4 octets
func IPv6FromBlocks ¶
IPv6FromBlocks returns an IPv6 address for the given 8 blocks
func (*IP) BitAtPosition ¶
BitAtPosition returns the bit at position pos
func (*IP) Compare ¶
Compare compares two IP addresses (returns 0 if equal, -1 if `ip` is smaller than `other`, 1 if `ip` is greater than `other`)
func (*IP) MaskLastNBits ¶
MaskLastNBits masks the last n bits of an IP address
type Prefix ¶
type Prefix struct {
// contains filtered or unexported fields
}
Prefix represents an IPv4 prefix
func NewPfxFromIPNet ¶
NewPfxFromIPNet creates a Prefix object from an gonet.IPNet object
func NewPrefixFromProtoPrefix ¶
NewPrefixFromProtoPrefix creates a Prefix from a proto Prefix
func PrefixFromString ¶
PrefixFromString converts prefix from string representation to Prefix
func (Prefix) Dedup ¶
Dedup gets a copy of Prefix from the cache. If Prefix is not in the cache it gets added.
func (*Prefix) GetSupernet ¶
GetSupernet gets the next common supernet of pfx and x