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 Freeze for PortScanner
impl !RefUnwindSafe for PortScanner
impl Send for PortScanner
impl Sync for PortScanner
impl Unpin for PortScanner
impl UnsafeUnpin for PortScanner
impl !UnwindSafe 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