Crates.io | wireguard-uapi |
lib.rs | wireguard-uapi |
version | 3.0.0 |
source | src |
created_at | 2019-10-01 05:07:41.609349 |
updated_at | 2023-04-23 19:19:54.275096 |
description | Control WireGuard interfaces. |
homepage | |
repository | https://github.com/gluxon/wireguard-uapi-rs |
max_upload_size | |
id | 169014 |
size | 182,492 |
This library implements the WireGuard Netlink API in Rust for Linux.
Here's a quick example.
use failure;
use wireguard_uapi::{DeviceInterface, WgSocket};
fn main() -> Result<(), failure::Error> {
let mut wg = WgSocket::connect()?;
let device = wg.get_device(DeviceInterface::from_name("wgtest0"))?;
print_device(&device);
Ok(())
}
Compiled binaries need the CAP_NET_ADMIN
capability to read network interfaces. If you're getting an access error while using this library, make sure the compiled executable has that permission. If you trust your compiled binary, one way to grant it is:
sudo setcap CAP_NET_ADMIN=+eip ./my-compiled-binary
This isn't an official WireGuard product. (Although I'm interested in making it so.)
Feel free to file bugs.