Documentation
¶
Index ¶
- type Entry
- type Index
- func (idx *Index[T]) Add(cidr netip.Prefix, metadata T) error
- func (idx *Index[T]) Cleanup(ttl time.Duration) int
- func (idx *Index[T]) Contains(ip netip.Addr) bool
- func (idx *Index[T]) Lookup(ip netip.Addr) (*LookupResult[T], bool)
- func (idx *Index[T]) MarkDeleted(cidr netip.Prefix)
- func (idx *Index[T]) Rebuild(entries []Entry[T]) error
- func (idx *Index[T]) Remove(cidr netip.Prefix) error
- type LookupResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Index ¶
type Index[T any] struct { // contains filtered or unexported fields }
Index maintains a CIDR tree for fast IP-to-metadata lookups with LRU caching.
func (*Index[T]) Lookup ¶
func (idx *Index[T]) Lookup(ip netip.Addr) (*LookupResult[T], bool)
Lookup finds the most specific CIDR range containing the given IP address.
func (*Index[T]) MarkDeleted ¶
MarkDeleted marks the given CIDR range as deleted without removing it from the index.
Click to show internal directories.
Click to hide internal directories.