patricia: github.com/kentik/patricia Index | Files | Directories

package patricia

import "github.com/kentik/patricia"

Index

Package Files

address_v4.go address_v6.go bits.go init.go net.go

func MergePrefixes32 Uses

func MergePrefixes32(left uint32, leftLength uint, right uint32, rightLength uint) (uint32, uint)

MergePrefixes32 merges two 32-bit prefixes, returning new prefix, new length

func MergePrefixes64 Uses

func MergePrefixes64(leftLeft uint64, leftRight uint64, leftLength uint, rightLeft uint64, rightRight uint64, rightLength uint) (uint64, uint64, uint)

MergePrefixes64 merges two pairs of uint64s, returning a new prefix, new length

func ParseFromIPAddr Uses

func ParseFromIPAddr(ipNet *net.IPNet) (*IPv4Address, *IPv6Address, error)

ParseFromIPAddr builds an IPv4Address or IPv6Address from a net.IPNet

func ParseIPFromString Uses

func ParseIPFromString(address string) (*IPv4Address, *IPv6Address, error)

ParseIPFromString parses a string address, returning a v4 or v6 IP address TODO: make this more performant:

- is the fmt.Sprintf necessary?

func ShiftLeftIPv6 Uses

func ShiftLeftIPv6(left uint64, right uint64, length uint, bitCount uint) (uint64, uint64, uint)

ShiftLeftIPv6 shifts IPv6 (as two uint64's) to the left

func ShiftRightIPv6 Uses

func ShiftRightIPv6(left uint64, right uint64, bitCount uint) (uint64, uint64)

ShiftRightIPv6 shifts IPv6 (as two uint64's) to the right - assumes left and rights have already been masked clean, so there's no extra bits

type IPv4Address Uses

type IPv4Address struct {
    Address uint32
    Length  uint
}

IPv4Address is a representation of an IPv4 address and CIDR

func NewIPv4Address Uses

func NewIPv4Address(address uint32, length uint) IPv4Address

NewIPv4Address creates an address from the input IPv4 address

func NewIPv4AddressFromBytes Uses

func NewIPv4AddressFromBytes(address []byte, length uint) IPv4Address

NewIPv4AddressFromBytes creates an address from the input IPv4 address bytes - address must be 4 or 16 bytes

func (*IPv4Address) IsLeftBitSet Uses

func (i *IPv4Address) IsLeftBitSet() bool

IsLeftBitSet returns whether the leftmost bit is set

func (*IPv4Address) ShiftLeft Uses

func (i *IPv4Address) ShiftLeft(shiftCount uint)

ShiftLeft shifts the address to the left

func (IPv4Address) String Uses

func (i IPv4Address) String() string

String returns a string version of this IP address. - not optimized for performance, alloates a byte slice

type IPv6Address Uses

type IPv6Address struct {
    Left   uint64
    Right  uint64
    Length uint
}

IPv6Address is a representation of an IPv6 address and CIDR

func NewIPv6Address Uses

func NewIPv6Address(address []byte, length uint) IPv6Address

NewIPv6Address creates an address from the input IPv6 bytes (must be length 16)

func (*IPv6Address) IsLeftBitSet Uses

func (ip *IPv6Address) IsLeftBitSet() bool

IsLeftBitSet returns whether the leftmost bit is set

func (*IPv6Address) ShiftLeft Uses

func (ip *IPv6Address) ShiftLeft(bitCount uint)

ShiftLeft shifts the bits |bitCount| bits left

func (IPv6Address) String Uses

func (ip IPv6Address) String() string

String returns a string version of this IP address. - not optimized for performance, alloates a byte slice

Directories

PathSynopsis
bool_tree
byte_tree
complex128_tree
complex64_tree
float32_tree
float64_tree
int16_tree
int32_tree
int64_tree
int8_tree
int_tree
rune_tree
string_tree
template
uint16_tree
uint32_tree
uint64_tree
uint8_tree
uint_tree

Package patricia imports 5 packages (graph) and is imported by 22 packages. Updated 2019-10-11. Refresh now. Tools for package owners.