5 releases

0.1.3 Dec 8, 2023
0.1.2 Nov 6, 2023
0.1.1 Oct 31, 2023
0.1.0 Oct 9, 2023
0.0.0 Oct 5, 2023

#769 in Network programming

Download history 6/week @ 2024-02-25 11/week @ 2024-03-10 69/week @ 2024-03-31

80 downloads per month

MIT license

15KB
250 lines

waifai Latest Version Crates.io

wai·fai is the pronunciation of the Wi-Fi word.
This is a library to interact with everything related to Wi-Fi: scan, connect, disconnect and even create hotspots.

Warning: This project goes through frequent API breaking changes and hasn't been thoroughly tested.

Currently, only Linux is supported (via nmcli), but there are plans to also add Windows support.

Usage

Minimum Supported Rust Version is 1.56.1.

fn main() -> Result<(), WFError> {
    let wifi = WiFi::new("wlan0".to_string());

    let networks = wifi.scan(true)?; // the argument forces a rescan or loading from cache
    let my_favorite_network = networks.first().unwrap();
    let connected = wifi.connect(&my_favorite_network.ssid, Some("my_password"))?;

    if connected {
        wifi.disconnect()?;
    } else {
        wifi.create(&my_favorite_network.ssid, Some("password"))?;
        wifi.start()?;
    }

    Ok(())
}

Check out this at examples/waifai.rs.

Documentation

The documentation is available at docs.rs.
Curious about the history and what changed between versions? Everything is in the CHANGELOG file.

Dependencies

~175KB