don't build tokio-tun on non-linux targets
This commit is contained in:
@@ -27,4 +27,6 @@ nym-task = { path = "../task" }
|
||||
tap.workspace = true
|
||||
thiserror.workspace = true
|
||||
tokio = { workspace = true, features = ["rt-multi-thread", "net", "io-util"] }
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
tokio-tun = "0.9.0"
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
#![cfg(target_os = "linux")]
|
||||
|
||||
use std::{
|
||||
net::{Ipv4Addr, SocketAddr},
|
||||
sync::Arc,
|
||||
|
||||
@@ -62,6 +62,8 @@ 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]
|
||||
|
||||
@@ -370,11 +370,17 @@ impl<St> Gateway<St> {
|
||||
// Once this is a bit more mature, make this a commandline flag instead of a compile time
|
||||
// flag
|
||||
#[cfg(feature = "wireguard")]
|
||||
if let Err(err) = nym_wireguard::start_wireguard(shutdown.subscribe()).await {
|
||||
// that's a nasty workaround, but anyhow errors are generally nicer, especially on exit
|
||||
bail!("{err}")
|
||||
{
|
||||
#[cfg(target_os = "linux")]
|
||||
if let Err(err) = nym_wireguard::start_wireguard(shutdown.subscribe()).await {
|
||||
// that's a nasty workaround, but anyhow errors are generally nicer, especially on exit
|
||||
bail!("{err}")
|
||||
}
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
panic!("wireguard is not supported on this platform")
|
||||
}
|
||||
|
||||
|
||||
info!("Finished nym gateway startup procedure - it should now be able to receive mix and client traffic!");
|
||||
|
||||
if let Err(err) = Self::wait_for_interrupt(shutdown).await {
|
||||
|
||||
Reference in New Issue
Block a user