Skip to main content

Module set

Module set 

Source
Expand description

§IP Address Sets

This module provides the IpSet model, a high-performance container for managing large collections of unique IP addresses.

§Performance Characteristics

IpSet uses a lazy normalization strategy. Insertions are $O(1)$ amortized, as they simply push to an internal buffer. The set is sorted and merged ($O(N \log N)$) only when a query method is called or when IpSet::canonicalize is invoked explicitly.

For maximum performance in multithreaded scanning:

  1. Build the set using insert, extend, or FromIterator.
  2. Call IpSet::canonicalize once.
  3. Use thread-safe query methods like IpSet::contains_canonical.

Structs§

IpSet
A collection of unique IP addresses stored as sorted, non-overlapping ranges.

Enums§

IpSetError
Errors that can occur when processing an IpSet.