innernet/wireguard-control/examples/enumerate.rs
Jake McGinty 09e68c2c01
(linux) wireguard-control: migrate from wireguard-control-sys to netlink crates (#177)
also introduces a new `netlink-request` crate to help modularize the netlink code. this currently depends on a fork of the `netlink` project, but we should be able to use the official version soon.
2022-01-07 18:35:21 +09:00

11 lines
287 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);
}