Documentation ¶
Index ¶
- Variables
- type Tree
- func (tree *Tree) AddCIDR(cidr string, val interface{}) error
- func (tree *Tree) AddCIDRb(cidr []byte, val interface{}) error
- func (tree *Tree) DeleteCIDR(cidr string) error
- func (tree *Tree) DeleteCIDRb(cidr []byte) error
- func (tree *Tree) DeleteWholeRangeCIDR(cidr string) error
- func (tree *Tree) DeleteWholeRangeCIDRb(cidr []byte) error
- func (tree *Tree) FindCIDR(cidr string) (interface{}, error)
- func (tree *Tree) FindCIDRb(cidr []byte) (interface{}, error)
- func (tree *Tree) SetCIDR(cidr string, val interface{}) error
- func (tree *Tree) SetCIDRb(cidr []byte, val interface{}) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree implements radix tree for working with IP/mask. Thread safety is not guaranteed, you should choose your own style of protecting safety of operations.
func NewTree ¶
NewTree creates Tree and preallocates (if preallocate not zero) number of nodes that would be ready to fill with data.
func (*Tree) AddCIDR ¶
AddCIDR adds value associated with IP/mask to the tree. Will return error for invalid CIDR or if value already exists.
func (*Tree) DeleteCIDR ¶
DeleteCIDR removes value associated with IP/mask from the tree.
func (*Tree) DeleteCIDRb ¶
func (*Tree) DeleteWholeRangeCIDR ¶
DeleteWholeRangeCIDR removes all values associated with IPs in the entire subnet specified by the CIDR.
func (*Tree) DeleteWholeRangeCIDRb ¶
func (*Tree) FindCIDR ¶
Find CIDR traverses tree to proper Node and returns previously saved information in longest covered IP.