diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-10-23 14:00:21 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2019-10-23 14:00:21 +0200 |
commit | 8107973342a31e8d654d31c1bb06786fc033d86c (patch) | |
tree | b0de39c32c76e098480f4237b02ed66e542b813c /src/platform/dummy | |
parent | Moved IO traits into platform module (diff) | |
download | wireguard-rs-8107973342a31e8d654d31c1bb06786fc033d86c.tar.xz wireguard-rs-8107973342a31e8d654d31c1bb06786fc033d86c.zip |
Work on pure WireGuard test
Diffstat (limited to '')
-rw-r--r-- | src/platform/dummy/bind.rs | 26 | ||||
-rw-r--r-- | src/platform/dummy/endpoint.rs | 23 |
2 files changed, 25 insertions, 24 deletions
diff --git a/src/platform/dummy/bind.rs b/src/platform/dummy/bind.rs index 14143ae..5010597 100644 --- a/src/platform/dummy/bind.rs +++ b/src/platform/dummy/bind.rs @@ -1,13 +1,14 @@ use std::error::Error; use std::fmt; use std::marker; -use std::net::SocketAddr; + use std::sync::mpsc::{sync_channel, Receiver, SyncSender}; use std::sync::Arc; use std::sync::Mutex; use super::super::bind::*; use super::super::Endpoint; +use super::UnitEndpoint; pub struct VoidOwner {} @@ -57,29 +58,6 @@ impl fmt::Display for TunError { } } -/* Endpoint implementation */ - -#[derive(Clone, Copy)] -pub struct UnitEndpoint {} - -impl Endpoint for UnitEndpoint { - fn from_address(_: SocketAddr) -> UnitEndpoint { - UnitEndpoint {} - } - - fn into_address(&self) -> SocketAddr { - "127.0.0.1:8080".parse().unwrap() - } - - fn clear_src(&mut self) {} -} - -impl UnitEndpoint { - pub fn new() -> UnitEndpoint { - UnitEndpoint {} - } -} - #[derive(Clone, Copy)] pub struct VoidBind {} diff --git a/src/platform/dummy/endpoint.rs b/src/platform/dummy/endpoint.rs index 8b13789..f5fc32c 100644 --- a/src/platform/dummy/endpoint.rs +++ b/src/platform/dummy/endpoint.rs @@ -1 +1,24 @@ +use std::net::SocketAddr; +use super::super::Endpoint; + +#[derive(Clone, Copy)] +pub struct UnitEndpoint {} + +impl Endpoint for UnitEndpoint { + fn from_address(_: SocketAddr) -> UnitEndpoint { + UnitEndpoint {} + } + + fn into_address(&self) -> SocketAddr { + "127.0.0.1:8080".parse().unwrap() + } + + fn clear_src(&mut self) {} +} + +impl UnitEndpoint { + pub fn new() -> UnitEndpoint { + UnitEndpoint {} + } +} |