pub struct TargetSet { /* private fields */ }Expand description
A blueprint pairing a set of IP addresses with a set of ports.
TargetSet supports lazy evaluation of the underlying sets. Volume queries
and iteration will safely trigger normalization of the IPs and ports.
Implementations§
Source§impl TargetSet
impl TargetSet
Sourcepub fn new(ips: IpSet, ports: PortSet) -> Self
pub fn new(ips: IpSet, ports: PortSet) -> Self
Creates a new scan blueprint. Defaults to an uncanonicalized state.
Sourcepub fn ip_count(&mut self) -> u128
pub fn ip_count(&mut self) -> u128
Returns the number of unique IP addresses in this set. Performs lazy normalization.
Sourcepub fn port_count(&self) -> usize
pub fn port_count(&self) -> usize
Returns the number of unique ports in this set.
Sourcepub fn canonicalize(&mut self)
pub fn canonicalize(&mut self)
Prepares the internal IP and Port sets for high-performance read-only access.
Sourcepub fn total_targets(&mut self) -> Result<u128, TargetError>
pub fn total_targets(&mut self) -> Result<u128, TargetError>
Returns the total number of targets. Performs lazy normalization if needed.
Returns a TargetError::CapacityOverflow if the calculation exceeds u128::MAX.
Sourcepub fn iter(&mut self) -> impl Iterator<Item = Target> + Send + '_
pub fn iter(&mut self) -> impl Iterator<Item = Target> + Send + '_
Creates a lazy iterator over every IP/Port combination. Performs lazy normalization.
This uses Arc internally to prevent O(N) memory allocations when iterating
over massive subnets (e.g., /8 or IPv6 ranges).
Sourcepub fn total_targets_canonical(&self) -> Result<u128, TargetError>
pub fn total_targets_canonical(&self) -> Result<u128, TargetError>
Thread-safe version of total_targets.
This method is strictly read-only. It returns TargetError::UncanonicalizedState
if the sets have not been normalized prior to concurrent access.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TargetSet
impl RefUnwindSafe for TargetSet
impl Send for TargetSet
impl Sync for TargetSet
impl Unpin for TargetSet
impl UnsafeUnpin for TargetSet
impl UnwindSafe for TargetSet
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more