Move platform specific code to platform directory

This commit is contained in:
Jon Häggblad
2023-10-05 09:03:12 +02:00
parent 1774606ec6
commit 63bbdfa523
6 changed files with 10 additions and 11 deletions
+6 -8
View File
@@ -1,20 +1,18 @@
#![cfg_attr(not(target_os = "linux"), allow(dead_code))]
use nym_task::TaskClient;
pub use error::WgError;
mod error;
#[cfg(target_os = "linux")]
mod event;
#[cfg(target_os = "linux")]
mod platform;
mod setup;
#[cfg(target_os = "linux")]
mod tun;
#[cfg(target_os = "linux")]
mod tun_device;
#[cfg(target_os = "linux")]
mod udp_listener;
// Currently the module related to setting up the virtual network device is platform specific.
#[cfg(target_os = "linux")]
use platform::linux::tun_device;
type ActivePeers =
dashmap::DashMap<std::net::SocketAddr, tokio::sync::mpsc::UnboundedSender<crate::event::Event>>;
@@ -0,0 +1 @@
pub(crate) mod tun_device;
+2
View File
@@ -0,0 +1,2 @@
#[cfg(target_os = "linux")]
pub(crate) mod linux;
+1 -1
View File
@@ -15,7 +15,7 @@ use tokio::{
time::timeout,
};
use crate::{event::Event, WgError};
use crate::{error::WgError, event::Event};
const MAX_PACKET: usize = 65535;
-2
View File
@@ -62,8 +62,6 @@ nym-statistics-common = { path = "../common/statistics" }
nym-task = { path = "../common/task" }
nym-types = { path = "../common/types" }
nym-validator-client = { path = "../common/client-libs/validator-client" }
[target.'cfg(target_os = "linux")'.dependencies]
nym-wireguard = { path = "../common/wireguard", optional = true }
[build-dependencies]