innernet/wireguard-control/examples/enumerate.rs

12 lines
287 B
Rust
Raw Normal View History

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);
}