tunio
tunio copied to clipboard
How do I use wintun?
Hi!
I'm interested in using tunio in Windows, yet I am struggling to get a simple example running. The docs seem to indicate I should place wintun.dll alongside the built exe, but I get an error.
use tunio::traits::{DriverT, InterfaceT};
use tunio::{DefaultDriver, DefaultInterface};
fn main() {
println!("Hello, world!");
// DefaultDriver is an alias for a supported driver for current platform.
// It may be not optimal for your needs (for example, it can lack support of TAP),
// but it will work in some cases. If you need another driver, then import and use it instead.
let mut driver = DefaultDriver::new().unwrap();
// Preparing configuration for new interface. We use `Builder` pattern for this.
let if_config = DefaultDriver::if_config_builder()
.name("iface1".to_string())
.build()
.unwrap();
// Then, we create the interface using config and start it immediately.
let mut interface = DefaultInterface::new_up(&mut driver, if_config).unwrap();
}
Output:
value: LibraryNotLoaded { reason: "LoadLibraryExW { source: Os { code: 193, kind: Uncategorized, message: \"%1 is not a valid Win32 application.\" } }" }', src\main.rs:9:43
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Presumably I am missing some documentation. If not, would it be possible to provide some guidance on how to use tunio on Windows via wintun.dll? Perhaps an additional example or further documentation?
Seems to go away if I use the amd64 wintun.dll...