[][src]Function oports::get_open_ports

pub async fn get_open_ports(
    ip: IpAddr,
    ports: Vec<u16>,
    concurrency: Option<usize>
) -> Vec<u16>

Retrieves a vec with open ports for a given vec of port numbers an IP adresses. The default concurrency is 100 if the Option resolves to a None value.


use async_std::net::{IpAddr, Ipv4Addr};

let ip_v4_addr = IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1));
let ports_to_check = (4000..4050).collect::<Vec<u16>>();
let concurrency = Some(10);

let open_ports = oports::get_open_ports(ip_v4_addr, ports_to_check, concurrency).await;

assert_eq!(vec![4040], open_ports);