aboutsummaryrefslogtreecommitdiffstats
path: root/src/platform/mod.rs
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2019-10-23 12:08:35 +0200
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2019-10-23 12:08:35 +0200
commitee3599d5507ceee23ef3382dbda9de8e73c54a00 (patch)
treed681a3f8a5a2d5e7bea779acecd1fc0798285d9e /src/platform/mod.rs
parentWork on platform specific code (Linux) (diff)
downloadwireguard-rs-ee3599d5507ceee23ef3382dbda9de8e73c54a00.tar.xz
wireguard-rs-ee3599d5507ceee23ef3382dbda9de8e73c54a00.zip
Moved IO traits into platform module
Diffstat (limited to 'src/platform/mod.rs')
-rw-r--r--src/platform/mod.rs32
1 files changed, 7 insertions, 25 deletions
diff --git a/src/platform/mod.rs b/src/platform/mod.rs
index a0bbc13..ecd559a 100644
--- a/src/platform/mod.rs
+++ b/src/platform/mod.rs
@@ -1,33 +1,15 @@
-use std::error::Error;
+mod endpoint;
-use super::wireguard::bind::Bind;
-use super::wireguard::tun::Tun;
-use super::wireguard::Endpoint;
+pub mod bind;
+pub mod tun;
-#[cfg(test)]
-mod dummy;
+pub use endpoint::Endpoint;
#[cfg(target_os = "linux")]
mod linux;
+#[cfg(test)]
+pub mod dummy;
+
#[cfg(target_os = "linux")]
pub use linux::LinuxTun as TunInstance;
-
-pub trait BindOwner: Send {
- type Error: Error;
-
- fn set_fwmark(&self, value: Option<u32>) -> Option<Self::Error>;
-}
-
-pub trait PlatformBind: Bind {
- type Owner: BindOwner;
-
- /// Bind to a new port, returning the reader/writer and
- /// an associated instance of the owner type, which closes the UDP socket upon "drop"
- /// and enables configuration of the fwmark value.
- fn bind(port: u16) -> Result<(Vec<Self::Reader>, Self::Writer, Self::Owner), Self::Error>;
-}
-
-pub trait PlatformTun: Tun {
- fn create(name: &str) -> Result<(Vec<Self::Reader>, Self::Writer, Self::MTU), Self::Error>;
-}