/// Check if any of given TCP ports is open on on any host from a given set.
Check if any of given TCP ports is open on on any host from a given set.
Check if any of given TCP ports is open on on any host from a given set .
fn find_open_ports<H: IntoIterator<Item=(MacAddr, IpAddr)>>(
    pc: pcap::ThreadingContext,
    device: &EthernetDevice,
    hosts: H,
    ports: &PortCollection) -> Result<Vec<(MacAddr, SocketAddr)>> {
    let hosts = hosts.into_iter()
        .filter_map(|(mac, ip)| match ip {
            IpAddr::V4(ip) => Some((mac, ip)),
            _              => None
        });
    let res = try!(TcpPortScanner::scan_ipv4_hosts(pc, device, hosts, ports))
        .into_iter()
        .map(|(mac, ip, p)| (mac, SocketAddr::V4(SocketAddrV4::new(ip, p))))
        .collect::<Vec<_>>();
    Ok(res)
}
fn find_open_ports < H : IntoIterator < Item = ( MacAddr , IpAddr ) > > ( pc : pcap :: ThreadingContext , device : & EthernetDevice , hosts : H , ports : & PortCollection ) -> Result < Vec < ( MacAddr , SocketAddr ) > > { let hosts = hosts . into_iter ( ) . filter_map ( | ( mac , ip ) | match ip { IpAddr :: V4 ( ip ) => Some ( ( mac , ip ) ) , _ => None } ) ; let res = try ! ( TcpPortScanner scan_ipv4_hosts ( pc device hosts ports ) ) . into_iter ( ) . map ( | ( mac , ip , p ) | ( mac , SocketAddr :: V4 ( SocketAddrV4 :: new ( ip , p ) ) ) ) . collect :: < Vec < _ > > ( ) ; Ok ( res ) }
Check if any of given TCP ports is open on on any host from a given set.
Check if any of given TCP ports is open on on any host from a given set .
pc
pcap::ThreadingContext
device
&EthernetDevice
hosts
H
ports
&PortCollection