waifai

Crates.iowaifai
lib.rswaifai
version0.1.6
sourcesrc
created_at2023-10-05 12:01:12.823751
updated_at2024-09-02 14:00:50.226757
descriptionInterface with Wi-Fi networks.
homepagehttps://github.com/inowattio
repositoryhttps://github.com/inowattio/waifai
max_upload_size
id993986
size19,355
CosminPerRam (CosminPerRam)

documentation

https://docs.rs/waifai/latest/waifai/

README

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.60.0.

fn main() -> Result<(), WFError> {
    let interfaces = WiFi::interfaces()?;
    let my_interface = interfaces.first().unwrap().clone();
    let wifi = WiFi::new(my_interface);
    
    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.

Commit count: 53

cargo fmt