pub struct PortScanner { /* private fields */ }Expand description
Concurrent TCP port scanner.
The Arc<Semaphore> caps TCP connects across all concurrent scan_host
calls on the same scanner instance. buffer_unordered alone would only
bound a single call — SweepEngine reuses one scanner across hundreds of
hosts in parallel, so without the shared permit pool a /24 sweep could
attempt hosts × ports simultaneous connects (easily 64k sockets).
Implementations§
Source§impl PortScanner
impl PortScanner
pub fn new(concurrency: usize) -> Self
pub async fn scan_host( &self, target: IpAddr, ports: Vec<u16>, timeout_ms: u64, ) -> Vec<PortResult>
pub async fn scan_host_with_progress( &self, target: IpAddr, ports: Vec<u16>, timeout_ms: u64, progress: Option<Arc<dyn Fn(PortScanProgress) + Send + Sync>>, ) -> Vec<PortResult>
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PortScanner
impl !UnwindSafe for PortScanner
impl Freeze for PortScanner
impl Send for PortScanner
impl Sync for PortScanner
impl Unpin for PortScanner
impl UnsafeUnpin for PortScanner
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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