Implement Wireguard

Implements Wireguard
This commit is contained in:
Jett Chen 2023-12-17 01:20:56 +08:00 committed by Conrad Kramer
parent 60257b256a
commit b008762a5b
59 changed files with 3824 additions and 529 deletions

View file

@ -1,15 +1,14 @@
use std::fmt::Debug;
use std::{fmt::Debug, io::Error, ptr};
use fehler::throws;
use std::io::Error;
use std::ptr;
use widestring::U16CString;
use windows::Win32::Foundation::GetLastError;
mod queue;
use super::TunOptions;
pub use queue::TunQueue;
use super::TunOptions;
pub struct TunInterface {
handle: sys::WINTUN_ADAPTER_HANDLE,
name: String,
@ -40,10 +39,7 @@ impl TunInterface {
if handle.is_null() {
unsafe { GetLastError() }.ok()?
}
TunInterface {
handle,
name: name_owned,
}
TunInterface { handle, name: name_owned }
}
pub fn name(&self) -> String {