diff --git a/tfclient/Cargo.toml b/tfclient/Cargo.toml index fa5ae78..b0fb595 100644 --- a/tfclient/Cargo.toml +++ b/tfclient/Cargo.toml @@ -31,7 +31,7 @@ base64-serde = "0.7.0" dnapi-rs = { version = "0.1", path = "../dnapi-rs" } serde_yaml = "0.9.19" openssl-sys = { version = "0.9.83", features = ["vendored"] } -nebula-ffi = { version = "0.1", path = "../nebula-ffi" } +nebula-ffi = { version = "0.1", path = "../nebula-ffi", optional = true } [build-dependencies] serde = { version = "1.0.157", features = ["derive"] } @@ -49,3 +49,6 @@ license-file = "LICENSE.txt" maintainer-scripts = "debian/" systemd-units = { enable = false, unit-name = "tfclient@" } +[features] +default = ["linked-nebula"] +linked-nebula = ["nebula-ffi"] \ No newline at end of file diff --git a/tfclient/src/main.rs b/tfclient/src/main.rs index cc4a6d6..ba79d2e 100644 --- a/tfclient/src/main.rs +++ b/tfclient/src/main.rs @@ -18,7 +18,13 @@ pub mod apiworker; pub mod config; pub mod daemon; pub mod dirs; + +#[cfg(feature = "linked-nebula")] pub mod nebulaworker; +#[cfg(not(feature = "linked-nebula"))] +#[path = "nebulaworker_inert.rs"] +pub mod nebulaworker; + pub mod socketclient; pub mod socketworker; pub mod timerworker; diff --git a/tfclient/src/nebulaworker_inert.rs b/tfclient/src/nebulaworker_inert.rs new file mode 100644 index 0000000..e356183 --- /dev/null +++ b/tfclient/src/nebulaworker_inert.rs @@ -0,0 +1,15 @@ +// Code to handle the nebula worker +// This is an inert version of the nebula worker that does nothing, used when linking to nebula is diabled. +// This is useful if you wish to run your own nebula binary, for example on platforms where CGo does not work. + +use crate::config::TFClientConfig; +use crate::daemon::ThreadMessageSender; +use std::sync::mpsc::Receiver; + +pub enum NebulaWorkerMessage { + Shutdown, + ConfigUpdated, + WakeUp, +} + +pub fn nebulaworker_main(_config: TFClientConfig, _instance: String, _transmitter: ThreadMessageSender, _rx: Receiver) {} \ No newline at end of file