peach-workspace/peach-network
glyph 7fe4715014 bump version and switch to rust 2021 2021-12-14 16:13:27 +02:00
..
.cargo First workspace commit 2021-08-06 13:58:40 -04:00
conf First workspace commit 2021-08-06 13:58:40 -04:00
src bump version and switch to rust 2021 2021-12-14 16:13:27 +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 bump version and switch to rust 2021 2021-12-14 16:13:27 +02:00
README.md bump version and switch to rust 2021 2021-12-14 16:13:27 +02:00
notes.txt First workspace commit 2021-08-06 13:58:40 -04:00

README.md

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 ip = network::ip("wlan0")?;
    let ssid = network::ssid("wlan0")?;

    let new_ap = Wifi { ssid: "Home".to_string(), pass: "SuperSecret".to_string() };
    network::add(new_ap)?;
    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.