peach-workspace/peach-network/README.md

33 lines
1.1 KiB
Markdown
Raw Normal View History

2021-08-06 17:58:40 +00:00
# peach-network
![Generic badge](https://img.shields.io/badge/version-0.3.0-<COLOR>.svg)
2021-08-06 17:58:40 +00:00
Network interface state query and modification library.
2021-08-06 17:58:40 +00:00
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
2021-08-06 17:58:40 +00:00
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.
2021-08-06 17:58:40 +00:00
## Example Usage
2021-08-06 17:58:40 +00:00
```rust
use peach_network::{network, NetworkError};
2021-08-06 17:58:40 +00:00
fn main() -> Result<(), NetworkError> {
let ip = network::ip("wlan0")?;
let ssid = network::ssid("wlan0")?;
2021-08-06 17:58:40 +00:00
let new_ap = Wifi { ssid: "Home".to_string(), pass: "SuperSecret".to_string() };
network::add(new_ap)?;
network::save()?;
2021-08-06 17:58:40 +00:00
Ok(())
}
```
2021-08-06 17:58:40 +00:00
## Licensing
2021-08-06 17:58:40 +00:00
AGPL-3.0