This crate provides a simple high-level asynchronous interface for managing Wi-Fi connections on Linux. It includes network scanning, connection management, and data models for representing Wi-Fi networks and interface configurations.
To ensure you are using the right tool for the job, please note that wifilite:
- is not a Network Manager: This crate is a thin wrapper around existing Linux Wi-Fi
backends (such as
wpa_supplicant). It does not manage DHCP, routing tables, or DNS. - is not for Low-level Control: This crate is not for you if you need Low-level control over low-level 802.11 frames or hardware-specific driver parameters. It is designed for simple connectivity tasks, not for advanced packet manipulation.
- is not for Real-Time Updates: This crate is designed for discrete, asynchronous
operations rather than constant telemetry. It provides high-level methods to
get_available,connect, anddisconnect; if you require a real-time stream of signal fluctuations or millisecond-level state changes, this is not the right tool.
Currently, this crate supports:
wpa_supplicant- useWpaWifi(Requires the daemon to be running, and permission to use it).
Pull Requests are welcome!
[dependencies]
wifilite = "0.1.0"
tokio = { version = "1", features = ["full"] }use wifilite::prelude::*;
#[tokio::main]
async fn main() -> Result<(), WifiError> {
// Connect to system
let wifi: WpaWifi = WpaWifi::new("wlan0").await?;
// List available networks
let networks: Vec<WifiNetwork> = wifi.get_available().await?;
// Connect to a network
wifi.connect(WifiAuth::Psk {
ssid: "MyNetwork".to_string(),
psk: "password".to_string(),
}).await?;
// Disconnect
wifi.disconnect().await?;
Ok(())
}