peach-workspace/peach-network/README.md

43 lines
1.5 KiB
Markdown

# peach-network
![Generic badge](https://img.shields.io/badge/version-0.4.0-<COLOR>.svg)
Network interface state query and modification library.
Interaction with wireless interfaces occurs primarily through the [wpactrl crate](https://docs.rs/wpactrl/0.3.1/wpactrl/) 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
```rust
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:
```toml
peach-network = { version = "0.3.0", features = ["miniserde_support"] }
```
## License
LGPL-3.0.