pub struct Positions { /* private fields */ }Expand description
Where each of an IpSet’s addresses falls in its enumeration.
An address’s index in IpSet::iter’s walk (merged IPv4 ranges ascending, then
IPv6) is its position. A sweep is counted in positions, as a port scan is in
PlannedTargets, so a journal records
progress without listing addresses.
Built from the ranges: a /8 costs one entry and a lookup is a binary search, so
this is cheap enough to consult per probe.
§A set larger than a position can count
A position is a u64, and a /64 is one address past what that counts. Ranges are
numbered in order until one would not fit, and the rest is unnumbered:
find answers None and unnumbered returns it
whole. Unnumbered addresses are asked again on every sitting. IPv4 is numbered first,
so it is never lost.
Implementations§
Source§impl Positions
impl Positions
Sourcepub fn of(set: &IpSet) -> Self
pub fn of(set: &IpSet) -> Self
Numbers set’s addresses.
An unmerged set is merged on a clone first, since positions count the canonical enumeration.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether nothing is numbered at all.
A plan whose first range is too large is empty by this; see
unnumbered.
Sourcepub fn unnumbered(&self) -> &[IpRange]
pub fn unnumbered(&self) -> &[IpRange]
The ranges the numbering could not reach, in enumeration order.
Empty for every IPv4 plan and every IPv6 plan narrower than a /64. A resumed
sweep asks about these again, since nothing is recorded against them.
Sourcepub fn find(&self, ip: IpAddr) -> Option<u64>
pub fn find(&self, ip: IpAddr) -> Option<u64>
Where ip falls in the enumeration, or None when the set does not hold
it or holds it beyond what a position can count.
Addresses a sweep finds without being asked have no position.
Sourcepub fn address_at(&self, position: u64) -> Option<IpAddr>
pub fn address_at(&self, position: u64) -> Option<IpAddr>
The address at position, or None past the end of the numbering.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Positions
impl RefUnwindSafe for Positions
impl Send for Positions
impl Sync for Positions
impl Unpin for Positions
impl UnsafeUnpin for Positions
impl UnwindSafe for Positions
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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