innernet/wireguard-control/examples/enumerate.rs

12 lines
285 B
Rust

use wireguard_control::{Backend, Device};
#[cfg(target_os = "linux")]
const BACKEND: Backend = Backend::Kernel;
#[cfg(not(target_os = "linux"))]
const BACKEND: Backend = Backend::Userspace;
fn main() {
let devices = Device::list(BACKEND).unwrap();
println!("{devices:?}");
}