Documentation ¶
Index ¶
- type FilterFunc
- type MatchesFunc
- type TreeIteratorV4
- func (iter *TreeIteratorV4) Address() patricia.IPv4Address
- func (iter *TreeIteratorV4) Delete(matchFunc MatchesFunc, matchVal uint8) int
- func (iter *TreeIteratorV4) DeleteWithBuffer(buf []uint8, matchFunc MatchesFunc, matchVal uint8) int
- func (iter *TreeIteratorV4) Next() bool
- func (iter *TreeIteratorV4) Tags() []uint8
- func (iter *TreeIteratorV4) TagsWithBuffer(ret []uint8) []uint8
- type TreeIteratorV6
- func (iter *TreeIteratorV6) Address() patricia.IPv6Address
- func (iter *TreeIteratorV6) Delete(matchFunc MatchesFunc, matchVal uint8) int
- func (iter *TreeIteratorV6) DeleteWithBuffer(buf []uint8, matchFunc MatchesFunc, matchVal uint8) int
- func (iter *TreeIteratorV6) Next() bool
- func (iter *TreeIteratorV6) Tags() []uint8
- func (iter *TreeIteratorV6) TagsWithBuffer(ret []uint8) []uint8
- type TreeV4
- func (t *TreeV4) Add(address patricia.IPv4Address, tag uint8, matchFunc MatchesFunc) (bool, int)
- func (t *TreeV4) AddOrUpdate(address patricia.IPv4Address, tag uint8, matchFunc MatchesFunc, ...) (bool, int)
- func (t *TreeV4) Clone() *TreeV4
- func (t *TreeV4) CountTags() int
- func (t *TreeV4) Delete(address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint8) int
- func (t *TreeV4) DeleteWithBuffer(buf []uint8, address patricia.IPv4Address, matchFunc MatchesFunc, ...) int
- func (t *TreeV4) FindDeepestTag(address patricia.IPv4Address) (bool, uint8)
- func (t *TreeV4) FindDeepestTags(address patricia.IPv4Address) (bool, []uint8)
- func (t *TreeV4) FindDeepestTagsAppend(ret []uint8, address patricia.IPv4Address) (bool, []uint8)
- func (t *TreeV4) FindDeepestTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) (bool, []uint8)
- func (t *TreeV4) FindDeepestTagsWithFilterAppend(ret []uint8, address patricia.IPv4Address, filterFunc FilterFunc) (bool, []uint8)
- func (t *TreeV4) FindTags(address patricia.IPv4Address) []uint8
- func (t *TreeV4) FindTagsAppend(ret []uint8, address patricia.IPv4Address) []uint8
- func (t *TreeV4) FindTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) []uint8
- func (t *TreeV4) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv4Address, filterFunc FilterFunc) []uint8
- func (t *TreeV4) Iterate() *TreeIteratorV4
- func (t *TreeV4) Set(address patricia.IPv4Address, tag uint8) (bool, int)
- func (t *TreeV4) SetOrUpdate(address patricia.IPv4Address, tag uint8, updateFunc UpdatesFunc) (bool, int)
- type TreeV6
- func (t *TreeV6) Add(address patricia.IPv6Address, tag uint8, matchFunc MatchesFunc) (bool, int)
- func (t *TreeV6) AddOrUpdate(address patricia.IPv6Address, tag uint8, matchFunc MatchesFunc, ...) (bool, int)
- func (t *TreeV6) Clone() *TreeV6
- func (t *TreeV6) CountTags() int
- func (t *TreeV6) Delete(address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint8) int
- func (t *TreeV6) DeleteWithBuffer(buf []uint8, address patricia.IPv6Address, matchFunc MatchesFunc, ...) int
- func (t *TreeV6) FindDeepestTag(address patricia.IPv6Address) (bool, uint8)
- func (t *TreeV6) FindDeepestTags(address patricia.IPv6Address) (bool, []uint8)
- func (t *TreeV6) FindDeepestTagsAppend(ret []uint8, address patricia.IPv6Address) (bool, []uint8)
- func (t *TreeV6) FindDeepestTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) (bool, []uint8)
- func (t *TreeV6) FindDeepestTagsWithFilterAppend(ret []uint8, address patricia.IPv6Address, filterFunc FilterFunc) (bool, []uint8)
- func (t *TreeV6) FindTags(address patricia.IPv6Address) []uint8
- func (t *TreeV6) FindTagsAppend(ret []uint8, address patricia.IPv6Address) []uint8
- func (t *TreeV6) FindTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) []uint8
- func (t *TreeV6) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv6Address, filterFunc FilterFunc) []uint8
- func (t *TreeV6) Iterate() *TreeIteratorV6
- func (t *TreeV6) Set(address patricia.IPv6Address, tag uint8) (bool, int)
- func (t *TreeV6) SetOrUpdate(address patricia.IPv6Address, tag uint8, updateFunc UpdatesFunc) (bool, int)
- type UpdatesFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FilterFunc ¶
FilterFunc is called on each result to see if it belongs in the resulting set
type MatchesFunc ¶
MatchesFunc is called to check if tag data matches the input value
type TreeIteratorV4 ¶ added in v1.1.0
type TreeIteratorV4 struct {
// contains filtered or unexported fields
}
TreeIteratorV4 is a stateful iterator over a tree.
func (*TreeIteratorV4) Address ¶ added in v1.1.0
func (iter *TreeIteratorV4) Address() patricia.IPv4Address
Address returns the current IP address for the iterator.
func (*TreeIteratorV4) Delete ¶ added in v1.2.1
func (iter *TreeIteratorV4) Delete(matchFunc MatchesFunc, matchVal uint8) int
Delete a tag from the current node if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - use DeleteWithBuffer if you can reuse slices, to cut down on allocations
func (*TreeIteratorV4) DeleteWithBuffer ¶ added in v1.2.1
func (iter *TreeIteratorV4) DeleteWithBuffer(buf []uint8, matchFunc MatchesFunc, matchVal uint8) int
DeleteWithBuffer a tag from the current node if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - uses input slice to reduce allocations
func (*TreeIteratorV4) Next ¶ added in v1.1.0
func (iter *TreeIteratorV4) Next() bool
Next jumps to the next element of a tree. It returns false if there is none.
func (*TreeIteratorV4) Tags ¶ added in v1.1.0
func (iter *TreeIteratorV4) Tags() []uint8
Tags returns the current tags for the iterator. This is not a copy and the result should not be used outside the iterator.
func (*TreeIteratorV4) TagsWithBuffer ¶ added in v1.2.1
func (iter *TreeIteratorV4) TagsWithBuffer(ret []uint8) []uint8
TagsWithBuffer returns the current tags for the iterator. To avoid allocation, it uses the provided buffer.
type TreeIteratorV6 ¶ added in v1.1.0
type TreeIteratorV6 struct {
// contains filtered or unexported fields
}
TreeIteratorV6 is a stateful iterator over a tree.
func (*TreeIteratorV6) Address ¶ added in v1.1.0
func (iter *TreeIteratorV6) Address() patricia.IPv6Address
Address returns the current IP address for the iterator.
func (*TreeIteratorV6) Delete ¶ added in v1.2.1
func (iter *TreeIteratorV6) Delete(matchFunc MatchesFunc, matchVal uint8) int
Delete a tag from the current node if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - use DeleteWithBuffer if you can reuse slices, to cut down on allocations
func (*TreeIteratorV6) DeleteWithBuffer ¶ added in v1.2.1
func (iter *TreeIteratorV6) DeleteWithBuffer(buf []uint8, matchFunc MatchesFunc, matchVal uint8) int
DeleteWithBuffer a tag from the current node if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - uses input slice to reduce allocations
func (*TreeIteratorV6) Next ¶ added in v1.1.0
func (iter *TreeIteratorV6) Next() bool
Next jumps to the next element of a tree. It returns false if there is none.
func (*TreeIteratorV6) Tags ¶ added in v1.1.0
func (iter *TreeIteratorV6) Tags() []uint8
Tags returns the current tags for the iterator. This is not a copy and the result should not be used outside the iterator.
func (*TreeIteratorV6) TagsWithBuffer ¶ added in v1.2.1
func (iter *TreeIteratorV6) TagsWithBuffer(ret []uint8) []uint8
TagsWithBuffer returns the current tags for the iterator. To avoid allocation, it uses the provided buffer.
type TreeV4 ¶
type TreeV4 struct {
// contains filtered or unexported fields
}
TreeV4 is an IP Address patricia tree
func (*TreeV4) Add ¶
func (t *TreeV4) Add(address patricia.IPv4Address, tag uint8, matchFunc MatchesFunc) (bool, int)
Add adds a tag to the tree - if matchFunc is non-nil, it will be used to ensure uniqueness at this node - returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV4) AddOrUpdate ¶ added in v1.2.1
func (t *TreeV4) AddOrUpdate(address patricia.IPv4Address, tag uint8, matchFunc MatchesFunc, updateFunc UpdatesFunc) (bool, int)
AddOrUpdate adds a tag to the tree or update it if it already exists - if matchFunc is non-nil, it will be used to ensure uniqueness at this node - returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV4) Clone ¶
Clone creates an identical copy of the tree - Note: the items in the tree are not deep copied
func (*TreeV4) CountTags ¶
CountTags iterates through the tree, counting the number of tags - note: unused nodes will have TagCount==0
func (*TreeV4) Delete ¶
func (t *TreeV4) Delete(address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint8) int
Delete a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - use DeleteWithBuffer if you can reuse slices, to cut down on allocations
func (*TreeV4) DeleteWithBuffer ¶
func (t *TreeV4) DeleteWithBuffer(buf []uint8, address patricia.IPv4Address, matchFunc MatchesFunc, matchVal uint8) int
DeleteWithBuffer a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - uses input slice to reduce allocations
func (*TreeV4) FindDeepestTag ¶
func (t *TreeV4) FindDeepestTag(address patricia.IPv4Address) (bool, uint8)
FindDeepestTag finds a tag at the deepest level in the tree, representing the closest match. - if that target node has multiple tags, the first in the list is returned
func (*TreeV4) FindDeepestTags ¶
func (t *TreeV4) FindDeepestTags(address patricia.IPv4Address) (bool, []uint8)
FindDeepestTags finds all tags at the deepest level in the tree, representing the closest match - use FindDeepestTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV4) FindDeepestTagsAppend ¶
FindDeepestTagsAppend finds all tags at the deepest level in the tree, representing the closest match - appends results to the input slice
func (*TreeV4) FindDeepestTagsWithFilter ¶ added in v1.2.1
func (t *TreeV4) FindDeepestTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) (bool, []uint8)
FindDeepestTagsWithFilter finds all tags at the deepest level in the tree, matching the provided filter, representing the closest match - use FindDeepestTagsWithFilterAppend if you can reuse slices, to cut down on allocations - returns true regardless of the result of the filtering function
func (*TreeV4) FindDeepestTagsWithFilterAppend ¶ added in v1.2.1
func (t *TreeV4) FindDeepestTagsWithFilterAppend(ret []uint8, address patricia.IPv4Address, filterFunc FilterFunc) (bool, []uint8)
FindDeepestTagsWithFilterAppend finds all tags at the deepest level in the tree, matching the provided filter, representing the closest match - appends results to the input slice - returns true regardless of the result of the filtering function
func (*TreeV4) FindTags ¶
func (t *TreeV4) FindTags(address patricia.IPv4Address) []uint8
FindTags finds all matching tags for given address - use FindTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV4) FindTagsAppend ¶
func (t *TreeV4) FindTagsAppend(ret []uint8, address patricia.IPv4Address) []uint8
FindTagsAppend finds all matching tags for given address and appends them to ret
func (*TreeV4) FindTagsWithFilter ¶
func (t *TreeV4) FindTagsWithFilter(address patricia.IPv4Address, filterFunc FilterFunc) []uint8
FindTagsWithFilter finds all matching tags that passes the filter function - use FindTagsWithFilterAppend if you can reuse slices, to cut down on allocations
func (*TreeV4) FindTagsWithFilterAppend ¶
func (t *TreeV4) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv4Address, filterFunc FilterFunc) []uint8
FindTagsWithFilterAppend finds all matching tags that passes the filter function - results are appended to the input slice
func (*TreeV4) Iterate ¶ added in v1.1.0
func (t *TreeV4) Iterate() *TreeIteratorV4
Iterate returns an iterator to find all nodes from a tree. It is important for the tree to not be modified while using the iterator.
func (*TreeV4) Set ¶
Set the single value for a node - overwrites what's there Returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV4) SetOrUpdate ¶ added in v1.2.1
func (t *TreeV4) SetOrUpdate(address patricia.IPv4Address, tag uint8, updateFunc UpdatesFunc) (bool, int)
SetOrUpdate the single value for a node - overwrites what's there using updateFunc if present - returns whether the tag count at this address was increased, and how many tags at this address
type TreeV6 ¶
type TreeV6 struct {
// contains filtered or unexported fields
}
TreeV6 is an IP Address patricia tree
func (*TreeV6) Add ¶
func (t *TreeV6) Add(address patricia.IPv6Address, tag uint8, matchFunc MatchesFunc) (bool, int)
Add adds a tag to the tree - if matchFunc is non-nil, it will be used to ensure uniqueness at this node - returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV6) AddOrUpdate ¶ added in v1.2.1
func (t *TreeV6) AddOrUpdate(address patricia.IPv6Address, tag uint8, matchFunc MatchesFunc, updateFunc UpdatesFunc) (bool, int)
AddOrUpdate adds a tag to the tree or update it if it already exists - if matchFunc is non-nil, it will be used to ensure uniqueness at this node - returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV6) Clone ¶
Clone creates an identical copy of the tree - Note: the items in the tree are not deep copied
func (*TreeV6) CountTags ¶
CountTags iterates through the tree, counting the number of tags - note: unused nodes will have TagCount==0
func (*TreeV6) Delete ¶
func (t *TreeV6) Delete(address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint8) int
Delete a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - use DeleteWithBuffer if you can reuse slices, to cut down on allocations
func (*TreeV6) DeleteWithBuffer ¶
func (t *TreeV6) DeleteWithBuffer(buf []uint8, address patricia.IPv6Address, matchFunc MatchesFunc, matchVal uint8) int
DeleteWithBuffer a tag from the tree if it matches matchVal, as determined by matchFunc. Returns how many tags are removed - uses input slice to reduce allocations
func (*TreeV6) FindDeepestTag ¶
func (t *TreeV6) FindDeepestTag(address patricia.IPv6Address) (bool, uint8)
FindDeepestTag finds a tag at the deepest level in the tree, representing the closest match. - if that target node has multiple tags, the first in the list is returned
func (*TreeV6) FindDeepestTags ¶
func (t *TreeV6) FindDeepestTags(address patricia.IPv6Address) (bool, []uint8)
FindDeepestTags finds all tags at the deepest level in the tree, representing the closest match - use FindDeepestTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV6) FindDeepestTagsAppend ¶
FindDeepestTagsAppend finds all tags at the deepest level in the tree, representing the closest match - appends results to the input slice
func (*TreeV6) FindDeepestTagsWithFilter ¶ added in v1.2.1
func (t *TreeV6) FindDeepestTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) (bool, []uint8)
FindDeepestTagsWithFilter finds all tags at the deepest level in the tree, matching the provided filter, representing the closest match - use FindDeepestTagsWithFilterAppend if you can reuse slices, to cut down on allocations - returns true regardless of the result of the filtering function
func (*TreeV6) FindDeepestTagsWithFilterAppend ¶ added in v1.2.1
func (t *TreeV6) FindDeepestTagsWithFilterAppend(ret []uint8, address patricia.IPv6Address, filterFunc FilterFunc) (bool, []uint8)
FindDeepestTagsWithFilterAppend finds all tags at the deepest level in the tree, matching the provided filter, representing the closest match - appends results to the input slice - returns true regardless of the result of the filtering function
func (*TreeV6) FindTags ¶
func (t *TreeV6) FindTags(address patricia.IPv6Address) []uint8
FindTags finds all matching tags for given address - use FindTagsAppend if you can reuse slices, to cut down on allocations
func (*TreeV6) FindTagsAppend ¶
func (t *TreeV6) FindTagsAppend(ret []uint8, address patricia.IPv6Address) []uint8
FindTagsAppend finds all matching tags for given address and appends them to ret
func (*TreeV6) FindTagsWithFilter ¶
func (t *TreeV6) FindTagsWithFilter(address patricia.IPv6Address, filterFunc FilterFunc) []uint8
FindTagsWithFilter finds all matching tags that passes the filter function - use FindTagsWithFilterAppend if you can reuse slices, to cut down on allocations
func (*TreeV6) FindTagsWithFilterAppend ¶
func (t *TreeV6) FindTagsWithFilterAppend(ret []uint8, address patricia.IPv6Address, filterFunc FilterFunc) []uint8
FindTagsWithFilterAppend finds all matching tags that passes the filter function - results are appended to the input slice
func (*TreeV6) Iterate ¶ added in v1.1.0
func (t *TreeV6) Iterate() *TreeIteratorV6
Iterate returns an iterator to find all nodes from a tree. It is important for the tree to not be modified while using the iterator.
func (*TreeV6) Set ¶
Set the single value for a node - overwrites what's there Returns whether the tag count at this address was increased, and how many tags at this address
func (*TreeV6) SetOrUpdate ¶ added in v1.2.1
func (t *TreeV6) SetOrUpdate(address patricia.IPv6Address, tag uint8, updateFunc UpdatesFunc) (bool, int)
SetOrUpdate the single value for a node - overwrites what's there using updateFunc if present - returns whether the tag count at this address was increased, and how many tags at this address
type UpdatesFunc ¶ added in v1.2.1
UpdatesFunc is called to update the tag value