Crate nordselect[][src]

NordSelect is a small library to find the best NordVPN servers for your needs.

This crate has a small CLI included that uses most of the functionality. Documentation of that can be found here or in the README.

Example

use nordselect::{ServerCategory, Protocol, Servers};
use nordselect::filters;
use nordselect::sorters;

fn main() {
    // Get data
    let mut servers = Servers::from_api().unwrap();

    // Filter: only servers in Canada
    servers.filter(&filters::CountryFilter::from_code("CA".to_string()));
    // Filter: only TCP compatible servers
    servers.filter(&filters::ProtocolFilter::from(Protocol::Tcp));
    // Filter: only standard servers
    servers.filter(&filters::CategoryFilter::from(ServerCategory::Standard));

    // Sort the servers on load.
    servers.sort(&sorters::LoadSorter);

    assert!(servers.perfect_server().is_some());
}

Re-exports

pub use servers::Protocol;
pub use servers::Server;
pub use servers::ServerCategory;
pub use servers::Servers;

Modules

filters

The filters module consists of the Filter trait (used to implement filters) and several common inplementations of it.

servers

Data structures and methods to interact with the NordVPN servers.

sorters

Sorters are ways to sort Servers, whereas the first one is the most likely to be selected for usage.