Documentation ¶
Overview ¶
Package iptree implements radix tree data structure for IPv4 and IPv6 networks.
Index ¶
- type Pair
- type Tree
- func (t *Tree) DeleteByIP(ip net.IP) (*Tree, bool)
- func (t *Tree) DeleteByNet(n *net.IPNet) (*Tree, bool)
- func (t *Tree) Enumerate() chan Pair
- func (t *Tree) GetByIP(ip net.IP) (interface{}, bool)
- func (t *Tree) GetByNet(n *net.IPNet) (interface{}, bool)
- func (t *Tree) InplaceInsertIP(ip net.IP, value interface{})
- func (t *Tree) InplaceInsertNet(n *net.IPNet, value interface{})
- func (t *Tree) InsertIP(ip net.IP, value interface{}) *Tree
- func (t *Tree) InsertNet(n *net.IPNet, value interface{}) *Tree
- func (t *Tree) UpdateDescendants(n *net.IPNet, callback UpdateDescendantsCallback)
- type UpdateDescendantsCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree struct {
// contains filtered or unexported fields
}
Tree is a radix tree for IPv4 and IPv6 networks.
func (*Tree) DeleteByIP ¶
DeleteByIP removes node by given IP address. The method returns new tree (old one remains unaffected) and flag indicating if deletion happens indeed.
func (*Tree) DeleteByNet ¶
DeleteByNet removes subtree which is contained by given network. The method returns new tree (old one remains unaffected) and flag indicating if deletion happens indeed.
func (*Tree) Enumerate ¶
Enumerate returns channel which is populated by key-value pairs of tree content.
func (*Tree) GetByIP ¶
GetByIP gets value for network which is equal to or contains given IP address.
func (*Tree) GetByNet ¶
GetByNet gets value for network which is equal to or contains given network.
func (*Tree) InplaceInsertIP ¶
InplaceInsertIP inserts (or replaces) value using given IP address as a key in current tree.
func (*Tree) InplaceInsertNet ¶
InplaceInsertNet inserts (or replaces) value using given network as a key in current tree.
func (*Tree) InsertIP ¶
InsertIP inserts value using given IP address as a key. The method returns new tree (old one remains unaffected).
func (*Tree) InsertNet ¶
InsertNet inserts value using given network as a key. The method returns new tree (old one remains unaffected).
func (*Tree) UpdateDescendants ¶
func (t *Tree) UpdateDescendants(n *net.IPNet, callback UpdateDescendantsCallback)
UpdateDescendants accepts a target network (node) and a callback, and updates all the descendants of the target node if the callback returns true as its second return value