peach-workspace/peach-network
2022-01-12 13:39:38 +02:00
..
conf First workspace commit 2021-08-06 13:58:40 -04:00
src add update and forget functions 2022-01-12 13:39:38 +02:00
.gitignore First workspace commit 2021-08-06 13:58:40 -04:00
.travis.yml First workspace commit 2021-08-06 13:58:40 -04:00
Cargo.toml add update and forget functions 2022-01-12 13:39:38 +02:00
notes.txt First workspace commit 2021-08-06 13:58:40 -04:00
README.md add update and forget functions 2022-01-12 13:39:38 +02:00

peach-network

Generic badge

Network interface state query and modification library.

Interaction with wireless interfaces occurs primarily through the wpactrl crate which provides "a pure-Rust lowlevel library for controlling wpasupplicant remotely". This approach is akin to using wpa_cli (a WPA command line client).

API Documentation

API documentation can be built and served with cargo doc --no-deps --open. The full set of available data structures and functions is listed in the peach_network::network module. A custom error type (NetworkError) is also publically exposed for library users; it encapsulates all possible error variants.

Example Usage

use peach_network::{network, NetworkError};

fn main() -> Result<(), NetworkError> {
    let wlan_iface = "wlan0";

    let wlan_ip = network::ip(wlan_iface)?;
    let wlan_ssid = network::ssid(wlan_iface)?;

    let ssid = "Home";
    let pass = "SuperSecret";

    network::add(&wlan_iface, &ssid, &pass)?;
    network::save()?;

    Ok(())
}

Feature Flags

Feature flags are used to offer Serialize and Deserialize implementations for all struct data types provided by this library. These traits are not provided by default. A choice of miniserde and serde is provided.

Define the desired feature in the Cargo.toml manifest of your project:

peach-network = { version = "0.3.0", features = ["miniserde_support"] }

License

LGPL-3.0.