get-port 1.3.0

Get an available port

get-port

Get an available port


Usage

use get_port;

fn main() {
    let an_available_port = get_port::get_port().unwrap(); // Returns the first available port in default range
    let an_available_port_in_range = get_port::get_port_in_range(get_port::PortRange { min: 5000, max: 6000 }).unwrap(); // Returns the first available port in speciefied range

    // ...
}

Future

  • Add get_port_prefered, used to supply (a list of) prefered port(s)
  • Add get_port_except to exclude certain port(s)
  • Write meaningful tests?