diff --git a/src/bin/sdlan/main.rs b/src/bin/sdlan/main.rs index 5a2da9c..6f519a5 100644 --- a/src/bin/sdlan/main.rs +++ b/src/bin/sdlan/main.rs @@ -28,6 +28,7 @@ async fn main() { token: "".to_owned(), allow_p2p: true, }, tx, + &sdlan_rs::get_install_channel(), ).await; let _ = rx.recv(); diff --git a/src/lib.rs b/src/lib.rs index b49db8f..7bffba8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -14,6 +14,7 @@ use tokio::sync::mpsc::channel; use tokio_util::sync::CancellationToken; use tracing::{debug, error}; pub use utils::{CommandLine, CommandLineInput}; +pub use network::get_install_channel; use sdlan_sn_rs::{ peer::SdlanSock, @@ -23,6 +24,7 @@ use sdlan_sn_rs::{ pub async fn run_sdlan( args: CommandLine, sender: std::sync::mpsc::Sender, + install_channel: &str, // start_stop_sender: Sender, // start_stop_receiver: Receiver, ) -> Result<()> { @@ -37,8 +39,9 @@ pub async fn run_sdlan( debug!("edge inited"); let cancel = CancellationToken::new(); + let install_chan = install_channel.to_owned(); tokio::spawn(async move { - if let Err(e) = async_main("linux".to_owned(), args, start_stop_chan, cancel).await { + if let Err(e) = async_main(install_chan, args, start_stop_chan, cancel).await { error!("failed to run async main: {}", e.as_str()); } }); diff --git a/src/network/mod.rs b/src/network/mod.rs index 92435c4..05cc51e 100644 --- a/src/network/mod.rs +++ b/src/network/mod.rs @@ -10,6 +10,7 @@ pub use packet::*; #[cfg_attr(target_os = "linux", path = "tun_linux.rs")] #[cfg_attr(target_os = "windows", path = "tun_win.rs")] mod tun; +pub use tun::get_install_channel; mod device; diff --git a/src/network/tun_linux.rs b/src/network/tun_linux.rs index 7c275b4..958621a 100644 --- a/src/network/tun_linux.rs +++ b/src/network/tun_linux.rs @@ -124,3 +124,7 @@ impl Iface { (&self.fd).write(content) } } + +pub fn get_install_channel() -> String { + "linux".to_owned() +} \ No newline at end of file diff --git a/src/network/tun_win.rs b/src/network/tun_win.rs index c75193c..40a26e8 100644 --- a/src/network/tun_win.rs +++ b/src/network/tun_win.rs @@ -93,3 +93,7 @@ pub fn new_iface(name: &str, _mode: Mode) -> Iface { create_wintun("./wintun.dll", name) // Ok(Box::new(create_wintun("/path/to/file"))) } + +pub fn get_install_channel() -> String { + "windows".to_owned() +} \ No newline at end of file