diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2020-03-29 18:21:48 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2020-03-29 18:21:48 +0200 |
commit | 12a7b371d4fed75f3934cf7d3788a6cf51c33c22 (patch) | |
tree | 970fc1287d6cbdbd419ef9151e6e94a077b5a7fd /src/platform/dummy/tun.rs | |
parent | Merge branch 'tests' (diff) | |
download | wireguard-rs-12a7b371d4fed75f3934cf7d3788a6cf51c33c22.tar.xz wireguard-rs-12a7b371d4fed75f3934cf7d3788a6cf51c33c22.zip |
Restructuring and dependency version bump.
Diffstat (limited to '')
-rw-r--r-- | src/platform/dummy/tun/dummy.rs (renamed from src/platform/dummy/tun.rs) | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/platform/dummy/tun.rs b/src/platform/dummy/tun/dummy.rs index 1955884..0f3479a 100644 --- a/src/platform/dummy/tun.rs +++ b/src/platform/dummy/tun/dummy.rs @@ -1,7 +1,13 @@ -use hex; -use log::debug; -use rand::rngs::OsRng; -use rand::Rng; +// This provides a mock tunnel interface. +// Which enables unit tests where WireGuard interfaces +// are configured to match each other and a full test of: +// +// - Handshake +// - Transport encryption/decryption +// +// Can be executed. + +use super::*; use std::cmp::min; use std::error::Error; @@ -11,15 +17,16 @@ use std::sync::Mutex; use std::thread; use std::time::Duration; -use super::super::tun::*; - -#[derive(Debug)] -pub enum TunError { - Disconnected, -} +use hex; +use log::debug; +use rand::rngs::OsRng; +use rand::Rng; pub struct TunTest {} +// Represents the "other end" (kernel/OS end) of the TUN connection: +// +// Used to send/receive packets to the mock WireGuard interface. pub struct TunFakeIO { id: u32, store: bool, |