-where
- Storage: AsRef<[u8]> + AsMut<[u8]>,
+ where
+ Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
@@ -113,40 +112,40 @@ fn bindgen_test_layout__GUID() {
unsafe { &(*(::std::ptr::null::<_GUID>())).Data1 as *const _ as usize },
0usize,
concat!(
- "Offset of field: ",
- stringify!(_GUID),
- "::",
- stringify!(Data1)
+ "Offset of field: ",
+ stringify!(_GUID),
+ "::",
+ stringify!(Data1)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<_GUID>())).Data2 as *const _ as usize },
4usize,
concat!(
- "Offset of field: ",
- stringify!(_GUID),
- "::",
- stringify!(Data2)
+ "Offset of field: ",
+ stringify!(_GUID),
+ "::",
+ stringify!(Data2)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<_GUID>())).Data3 as *const _ as usize },
6usize,
concat!(
- "Offset of field: ",
- stringify!(_GUID),
- "::",
- stringify!(Data3)
+ "Offset of field: ",
+ stringify!(_GUID),
+ "::",
+ stringify!(Data3)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<_GUID>())).Data4 as *const _ as usize },
8usize,
concat!(
- "Offset of field: ",
- stringify!(_GUID),
- "::",
- stringify!(Data4)
+ "Offset of field: ",
+ stringify!(_GUID),
+ "::",
+ stringify!(Data4)
)
);
}
@@ -249,20 +248,20 @@ fn bindgen_test_layout__NET_LUID_LH() {
unsafe { &(*(::std::ptr::null::<_NET_LUID_LH>())).Value as *const _ as usize },
0usize,
concat!(
- "Offset of field: ",
- stringify!(_NET_LUID_LH),
- "::",
- stringify!(Value)
+ "Offset of field: ",
+ stringify!(_NET_LUID_LH),
+ "::",
+ stringify!(Value)
)
);
assert_eq!(
unsafe { &(*(::std::ptr::null::<_NET_LUID_LH>())).Info as *const _ as usize },
0usize,
concat!(
- "Offset of field: ",
- stringify!(_NET_LUID_LH),
- "::",
- stringify!(Info)
+ "Offset of field: ",
+ stringify!(_NET_LUID_LH),
+ "::",
+ stringify!(Info)
)
);
}
@@ -311,33 +310,33 @@ pub struct wintun {
pub WintunCloseAdapter: unsafe extern "C" fn(arg1: WINTUN_ADAPTER_HANDLE),
pub WintunOpenAdapter: unsafe extern "C" fn(arg1: LPCWSTR) -> WINTUN_ADAPTER_HANDLE,
pub WintunGetAdapterLUID:
- unsafe extern "C" fn(arg1: WINTUN_ADAPTER_HANDLE, arg2: *mut NET_LUID),
+ unsafe extern "C" fn(arg1: WINTUN_ADAPTER_HANDLE, arg2: *mut NET_LUID),
pub WintunGetRunningDriverVersion: unsafe extern "C" fn() -> DWORD,
pub WintunDeleteDriver: unsafe extern "C" fn() -> BOOL,
pub WintunSetLogger: unsafe extern "C" fn(arg1: WINTUN_LOGGER_CALLBACK),
pub WintunStartSession:
- unsafe extern "C" fn(arg1: WINTUN_ADAPTER_HANDLE, arg2: DWORD) -> WINTUN_SESSION_HANDLE,
+ unsafe extern "C" fn(arg1: WINTUN_ADAPTER_HANDLE, arg2: DWORD) -> WINTUN_SESSION_HANDLE,
pub WintunEndSession: unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE),
pub WintunGetReadWaitEvent: unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE) -> HANDLE,
pub WintunReceivePacket:
- unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: *mut DWORD) -> *mut BYTE,
+ unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: *mut DWORD) -> *mut BYTE,
pub WintunReleaseReceivePacket:
- unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: *const BYTE),
+ unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: *const BYTE),
pub WintunAllocateSendPacket:
- unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: DWORD) -> *mut BYTE,
+ unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: DWORD) -> *mut BYTE,
pub WintunSendPacket: unsafe extern "C" fn(arg1: WINTUN_SESSION_HANDLE, arg2: *const BYTE),
}
impl wintun {
pub unsafe fn new(path: P) -> Result
- where
- P: AsRef<::std::ffi::OsStr>,
+ where
+ P: AsRef<::std::ffi::OsStr>,
{
let library = ::libloading::Library::new(path)?;
Self::from_library(library)
}
pub unsafe fn from_library(library: L) -> Result
- where
- L: Into<::libloading::Library>,
+ where
+ L: Into<::libloading::Library>,
{
let __library = library.into();
let WintunCreateAdapter = __library.get(b"WintunCreateAdapter\0").map(|sym| *sym)?;
diff --git a/switch/wintun/.gitignore b/switch/wintun/.gitignore
deleted file mode 100644
index cbd68e5..0000000
--- a/switch/wintun/.gitignore
+++ /dev/null
@@ -1,14 +0,0 @@
-
-out.pcap
-
-# Generated by Cargo
-# will have compiled files and executables
-debug/
-target/
-
-# These are backup files generated by rustfmt
-**/*.rs.bk
-
-# MSVC Windows builds of rustc generate these, which store debugging information
-*.pdb
-/.idea
diff --git a/switch/wintun/CHANGELOG.md b/switch/wintun/CHANGELOG.md
deleted file mode 100644
index f76ead6..0000000
--- a/switch/wintun/CHANGELOG.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# ChangeLog
-
-This format is based on [Keep a Changelog](https://keepachangelog.com/)
-and this project adheres to [Semantic Versioning](https://semver.org).
-
-## [0.2.1] - 2021-12-03
-
-### Fixed
-Type in readme
-
-## [0.2.0] - 2021-12-03
-
-Added support for wintun 0.14.
-
-### Breaking Changes
-
-- Wintun driver versions before `0.14` are no longer support due to beraking
-changes in the C API
-- `Adapter::create` returns a `Result` instead of a `Result`.
-This was done because the underlying Wintun function was changed to only return an adapter handle
-- `Adapter::create` the pool parameter was removed because it was also removed from the C function
-- `Adapter::delete` takes no parameters and returns a `Result<(), ()>`.
-The `force_close_sessions` parameter was removed because it was removed from the
-C function. Same for the bool inside the Ok(..) variant
-- `Adapter::create` and `Adapter::open` return `Arc` instead of `Adapter`
-- `get_running_driver_version` now returns a proper Result.
-
-### Added
-
-- `reset_logger` function to disable logging after a logger has been set.
-
-## [0.1.5] - 2021-08-27
-
-### Fixed
-
-- Readme on crates.io
-
-## [0.1.4] - 2021-08-27
-
-### Added
-- `panic_on_unsent_packets` feature flag to help in debugging ring buffer blockage issues
-
-## [0.1.3] - 2021-06-28
-
-### Fixed
-
-- Cargo.toml metadata to include `package.metadata.docs.rs.default-target`.
-Fixes build issue on docs.rs (we can only build docs on windows, 0.1.1 doesn't work)
-
-## [0.1.2] - 2021-06-28
-docs.rs testing
-
-## [0.1.1] - 2021-06-28
-
-- Cargo.toml metadata to build on linux
-
-## [0.1.0] - 2021-06-28
-
-First release with initial api
-
diff --git a/switch/wintun/Cargo.lock b/switch/wintun/Cargo.lock
deleted file mode 100644
index f8a445e..0000000
--- a/switch/wintun/Cargo.lock
+++ /dev/null
@@ -1,427 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "aho-corasick"
-version = "0.7.18"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f"
-dependencies = [
- "memchr",
-]
-
-[[package]]
-name = "atty"
-version = "0.2.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
-dependencies = [
- "hermit-abi",
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "bitflags"
-version = "1.3.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
-
-[[package]]
-name = "byteorder"
-version = "1.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
-
-[[package]]
-name = "cfg-if"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
-
-[[package]]
-name = "derive-into-owned"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "576fce04d31d592013a5887ba8d9c3830adff329e5096d7e1eb5e8e61262ca62"
-dependencies = [
- "quote 0.3.15",
- "syn 0.11.11",
-]
-
-[[package]]
-name = "either"
-version = "1.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
-
-[[package]]
-name = "env_logger"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a19187fea3ac7e84da7dacf48de0c45d63c6a76f9490dae389aead16c243fce3"
-dependencies = [
- "atty",
- "humantime",
- "log",
- "regex",
- "termcolor",
-]
-
-[[package]]
-name = "getrandom"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7fcd999463524c52659517fe2cea98493cfe485d10565e7b0fb07dbba7ad2753"
-dependencies = [
- "cfg-if",
- "libc",
- "wasi",
-]
-
-[[package]]
-name = "hermit-abi"
-version = "0.1.19"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
-dependencies = [
- "libc",
-]
-
-[[package]]
-name = "humantime"
-version = "2.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
-
-[[package]]
-name = "hwaddr"
-version = "0.1.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e414433a9e4338f4e87fa29d0670c883a5e73e7955c45f4a49130c0aa992c85b"
-dependencies = [
- "phf",
-]
-
-[[package]]
-name = "itertools"
-version = "0.10.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "69ddb889f9d0d08a67338271fa9b62996bc788c7796a5c18cf057420aaed5eaf"
-dependencies = [
- "either",
-]
-
-[[package]]
-name = "libc"
-version = "0.2.108"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8521a1b57e76b1ec69af7599e75e38e7b7fad6610f037db8c79b127201b5d119"
-
-[[package]]
-name = "libloading"
-version = "0.7.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "afe203d669ec979b7128619bae5a63b7b42e9203c1b29146079ee05e2f604b52"
-dependencies = [
- "cfg-if",
- "winapi",
-]
-
-[[package]]
-name = "log"
-version = "0.4.14"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
-dependencies = [
- "cfg-if",
-]
-
-[[package]]
-name = "memchr"
-version = "2.4.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
-
-[[package]]
-name = "once_cell"
-version = "1.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
-
-[[package]]
-name = "packet"
-version = "0.1.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c136c7ad0619ed4f88894aecf66ad86c80683e7b5d707996e6a3a7e0e3916944"
-dependencies = [
- "bitflags",
- "byteorder",
- "hwaddr",
- "thiserror",
-]
-
-[[package]]
-name = "pcap-file"
-version = "1.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6ad13fed1a83120159aea81b265074f21d753d157dd16b10cc3790ecba40a341"
-dependencies = [
- "byteorder",
- "derive-into-owned",
- "thiserror",
-]
-
-[[package]]
-name = "phf"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3dfb61232e34fcb633f43d12c58f83c1df82962dcdfa565a4e866ffc17dafe12"
-dependencies = [
- "phf_shared",
-]
-
-[[package]]
-name = "phf_shared"
-version = "0.8.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c00cf8b9eafe68dde5e9eaa2cef8ee84a9336a47d566ec55ca16589633b65af7"
-dependencies = [
- "siphasher",
-]
-
-[[package]]
-name = "ppv-lite86"
-version = "0.2.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ed0cfbc8191465bed66e1718596ee0b0b35d5ee1f41c5df2189d0fe8bde535ba"
-
-[[package]]
-name = "proc-macro2"
-version = "1.0.32"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ba508cc11742c0dc5c1659771673afbab7a0efab23aa17e854cbab0837ed0b43"
-dependencies = [
- "unicode-xid 0.2.2",
-]
-
-[[package]]
-name = "quote"
-version = "0.3.15"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7a6e920b65c65f10b2ae65c831a81a073a89edd28c7cce89475bff467ab4167a"
-
-[[package]]
-name = "quote"
-version = "1.0.10"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "38bc8cc6a5f2e3655e0899c1b848643b2562f853f114bfec7be120678e3ace05"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
-name = "rand"
-version = "0.8.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
-dependencies = [
- "libc",
- "rand_chacha",
- "rand_core",
- "rand_hc",
-]
-
-[[package]]
-name = "rand_chacha"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
-dependencies = [
- "ppv-lite86",
- "rand_core",
-]
-
-[[package]]
-name = "rand_core"
-version = "0.6.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
-dependencies = [
- "getrandom",
-]
-
-[[package]]
-name = "rand_hc"
-version = "0.3.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
-dependencies = [
- "rand_core",
-]
-
-[[package]]
-name = "regex"
-version = "1.5.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
-dependencies = [
- "aho-corasick",
- "memchr",
- "regex-syntax",
-]
-
-[[package]]
-name = "regex-syntax"
-version = "0.6.25"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b"
-
-[[package]]
-name = "siphasher"
-version = "0.3.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "533494a8f9b724d33625ab53c6c4800f7cc445895924a8ef649222dcb76e938b"
-
-[[package]]
-name = "subprocess"
-version = "0.2.8"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "055cf3ebc2981ad8f0a5a17ef6652f652d87831f79fddcba2ac57bcb9a0aa407"
-dependencies = [
- "libc",
- "winapi",
-]
-
-[[package]]
-name = "syn"
-version = "0.11.11"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
-dependencies = [
- "quote 0.3.15",
- "synom",
- "unicode-xid 0.0.4",
-]
-
-[[package]]
-name = "syn"
-version = "1.0.82"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8daf5dd0bb60cbd4137b1b587d2fc0ae729bc07cf01cd70b36a1ed5ade3b9d59"
-dependencies = [
- "proc-macro2",
- "quote 1.0.10",
- "unicode-xid 0.2.2",
-]
-
-[[package]]
-name = "synom"
-version = "0.11.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6"
-dependencies = [
- "unicode-xid 0.0.4",
-]
-
-[[package]]
-name = "termcolor"
-version = "1.1.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
-dependencies = [
- "winapi-util",
-]
-
-[[package]]
-name = "thiserror"
-version = "1.0.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
-dependencies = [
- "thiserror-impl",
-]
-
-[[package]]
-name = "thiserror-impl"
-version = "1.0.30"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
-dependencies = [
- "proc-macro2",
- "quote 1.0.10",
- "syn 1.0.82",
-]
-
-[[package]]
-name = "unicode-xid"
-version = "0.0.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc"
-
-[[package]]
-name = "unicode-xid"
-version = "0.2.2"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3"
-
-[[package]]
-name = "wasi"
-version = "0.10.2+wasi-snapshot-preview1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
-
-[[package]]
-name = "widestring"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c"
-
-[[package]]
-name = "winapi"
-version = "0.3.9"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
-dependencies = [
- "winapi-i686-pc-windows-gnu",
- "winapi-x86_64-pc-windows-gnu",
-]
-
-[[package]]
-name = "winapi-i686-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
-
-[[package]]
-name = "winapi-util"
-version = "0.1.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
-dependencies = [
- "winapi",
-]
-
-[[package]]
-name = "winapi-x86_64-pc-windows-gnu"
-version = "0.4.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
-
-[[package]]
-name = "wintun"
-version = "0.2.1"
-dependencies = [
- "env_logger",
- "itertools",
- "libloading",
- "log",
- "once_cell",
- "packet",
- "pcap-file",
- "rand",
- "subprocess",
- "widestring",
- "winapi",
-]
diff --git a/switch/wintun/Cargo.toml b/switch/wintun/Cargo.toml
deleted file mode 100644
index 827b9b1..0000000
--- a/switch/wintun/Cargo.toml
+++ /dev/null
@@ -1,35 +0,0 @@
-[package]
-name = "wintun"
-version = "0.2.1"
-edition = "2021"
-authors = ["null.black Inc. ", "Troy Neubauer "]
-repository = "https://github.com/nulldotblack/wintun"
-readme = "README.md"
-documentation = "https://docs.rs/wintun/"
-description = "Safe idiomatic bindings to the WinTun C library"
-license = "MIT"
-keywords = ["wintun", "tap", "tun", "vpn", "wireguard"]
-categories = ["api-bindings"]
-
-[package.metadata.docs.rs]
-default-target = "x86_64-pc-windows-msvc"
-targets = ["aarch64-pc-windows-msvc", "i686-pc-windows-msvc", "x86_64-pc-windows-msvc"]
-
-[features]
-panic_on_unsent_packets = []
-
-[dependencies]
-winapi = { version = "0.3", features = ["synchapi", "winbase", "winerror", "ipexport", "iphlpapi", "handleapi"] }
-widestring = "0.4"
-libloading = "0.7"
-once_cell = "1.8"
-log = "0.4"
-rand = "0.8.3"
-itertools = "0.10.1"
-
-[dev-dependencies]
-env_logger = "0.8"
-winapi = { version = "0.3", features = ["netioapi", "iptypes", "iphlpapi", "nldef"] }
-packet = "0.1.4"
-pcap-file = "1.1.1"
-subprocess = "0.2.7"
diff --git a/switch/wintun/LICENSE b/switch/wintun/LICENSE
deleted file mode 100644
index 00fa958..0000000
--- a/switch/wintun/LICENSE
+++ /dev/null
@@ -1,7 +0,0 @@
-Copyright 2021 null.black Inc.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/switch/wintun/README.md b/switch/wintun/README.md
deleted file mode 100644
index a14ea95..0000000
--- a/switch/wintun/README.md
+++ /dev/null
@@ -1,80 +0,0 @@
-# wintun
-
-Safe rust idiomatic bindings for the Wintun C library:
-
-All features of the Wintun library are wrapped using pure rust types and functions to make
-usage feel ergonomic.
-
-## Usage
-
-Inside your code load the wintun.dll signed driver file, downloaded from ,
-using [`load`], [`load_from_path`] or [`load_from_library`].
-
-Then either call [`Adapter::create`] or [`Adapter::open`] to obtain a wintun
-adapter. Start a session with [`Adapter::start_session`].
-
-## Example
-```rust
-use std::sync::Arc;
-
-//Must be run as Administrator because we create network adapters
-//Load the wintun dll file so that we can call the underlying C functions
-//Unsafe because we are loading an arbitrary dll file
-let wintun = unsafe { wintun::load_from_path("path/to/wintun.dll") }
- .expect("Failed to load wintun dll");
-
-//Try to open an adapter with the name "Demo"
-let adapter = match wintun::Adapter::open(&wintun, "Demo") {
- Ok(a) => a,
- Err(_) => {
- //If loading failed (most likely it didn't exist), create a new one
- wintun::Adapter::create(&wintun, "Example", "Demo", None)
- .expect("Failed to create wintun adapter!")
- }
-};
-//Specify the size of the ring buffer the wintun driver should use.
-let session = Arc::new(adapter.start_session(wintun::MAX_RING_CAPACITY).unwrap());
-
-//Get a 20 byte packet from the ring buffer
-let mut packet = session.allocate_send_packet(20).unwrap();
-let bytes: &mut [u8] = packet.bytes_mut();
-//Write IPV4 version and header length
-bytes[0] = 0x40;
-
-//Finish writing IP header
-bytes[9] = 0x69;
-bytes[10] = 0x04;
-bytes[11] = 0x20;
-//...
-
-//Send the packet to wintun virtual adapter for processing by the system
-session.send_packet(packet);
-
-//Stop any readers blocking for data on other threads
-//Only needed when a blocking reader is preventing shutdown Ie. it holds an Arc to the
-//session, blocking it from being dropped
-session.shutdown();
-
-//the session is stopped on drop
-//drop(session);
-
-//drop(adapter)
-//And the adapter closes its resources when dropped
-```
-
-See `examples/wireshark.rs` for a more complete example that writes received packets to a pcap
-file.
-
-## Features
-
-- `panic_on_unsent_packets`: Panics if a send packet is dropped without being sent. Useful for
-debugging packet issues because unsent packets that are dropped without being sent hold up
-wintun's internal ring buffer.
-
-## TODO:
-- Add async support
-Requires hooking into a windows specific reactor and registering read interest on wintun's read
-handle. Asyncify other slow operations via tokio::spawn_blocking. As always, PR's are welcome!
-
-
-License: MIT
diff --git a/switch/wintun/bindgen.sh b/switch/wintun/bindgen.sh
deleted file mode 100644
index 0635fc0..0000000
--- a/switch/wintun/bindgen.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-bindgen \
---allowlist-function "Wintun.*" \
---allowlist-type "WINTUN_.*" \
---dynamic-loading wintun \
---dynamic-link-require-all \
-wintun/wintun_functions.h > src/wintun_raw.rs
diff --git a/switch/wintun/src/adapter.rs b/switch/wintun/src/adapter.rs
deleted file mode 100644
index f8ed86f..0000000
--- a/switch/wintun/src/adapter.rs
+++ /dev/null
@@ -1,345 +0,0 @@
-/// Representation of a winton adapter with safe idiomatic bindings to the functionality provided by
-/// the WintunAdapter* C functions.
-///
-/// The [`Adapter::create`] and [`Adapter::open`] functions serve as the entry point to using
-/// wintun functionality
-use crate::error;
-use crate::session;
-use crate::util;
-use crate::util::UnsafeHandle;
-use crate::wintun_raw;
-use crate::Wintun;
-
-use std::ptr;
-use std::sync::Arc;
-
-use itertools::Itertools;
-use log::*;
-use once_cell::sync::OnceCell;
-use rand::Rng;
-
-use widestring::U16CStr;
-use widestring::U16CString;
-
-use winapi::{
- shared::winerror,
- um::{ipexport, iphlpapi, synchapi},
-};
-
-/// Wrapper around a
-pub struct Adapter {
- adapter: UnsafeHandle,
- wintun: Wintun,
- guid: u128,
-}
-
-fn encode_utf16(string: &str, max_characters: usize) -> Result {
- let utf16 = U16CString::from_str(string)?;
- if utf16.len() >= max_characters {
- //max_characters is the maximum number of characters including the null terminator. And .len() measures the
- //number of characters (excluding the null terminator). Therefore we can hold a string with
- //max_characters - 1 because the null terminator sits in the last element. However a string
- //of length max_characters needs max_characters + 1 to store the null terminator the >=
- //check holds
- Err(format!(
- //TODO: Better error handling
- "Length too large. Size: {}, Max: {}",
- utf16.len(),
- max_characters
- )
- .into())
- } else {
- Ok(utf16)
- }
-}
-
-fn encode_pool_name(name: &str) -> Result {
- encode_utf16(name, crate::MAX_POOL)
-}
-
-fn encode_adapter_name(name: &str) -> Result {
- encode_utf16(name, crate::MAX_POOL)
-}
-
-fn get_adapter_luid(wintun: &Wintun, adapter: wintun_raw::WINTUN_ADAPTER_HANDLE) -> u64 {
- let mut luid: wintun_raw::NET_LUID = unsafe { std::mem::zeroed() };
- unsafe { wintun.WintunGetAdapterLUID(adapter, &mut luid as *mut wintun_raw::NET_LUID) };
- unsafe { std::mem::transmute(luid) }
-}
-
-impl Adapter {
- //TODO: Call get last error for error information on failure and improve error types
-
- /// Creates a new wintun adapter inside the pool `pool` with name `name`
- ///
- /// Optionally a GUID can be specified that will become the GUID of this adapter once created.
- /// Adapters obtained via this function will be able to return their adapter index via
- /// [`Adapter::get_adapter_index`]
- pub fn create(
- wintun: &Wintun,
- pool: &str,
- name: &str,
- guid: Option,
- ) -> Result