From ee3599d5507ceee23ef3382dbda9de8e73c54a00 Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Wed, 23 Oct 2019 12:08:35 +0200 Subject: Moved IO traits into platform module --- src/platform/mod.rs | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'src/platform/mod.rs') 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) -> Option; -} - -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::Writer, Self::Owner), Self::Error>; -} - -pub trait PlatformTun: Tun { - fn create(name: &str) -> Result<(Vec, Self::Writer, Self::MTU), Self::Error>; -} -- cgit v1.2.3-59-g8ed1b