diff --git a/src/client.rs b/src/client.rs index 1c6f63f36..87660bfbc 100644 --- a/src/client.rs +++ b/src/client.rs @@ -47,13 +47,15 @@ pub use super::lang::*; pub mod file_trait; pub mod helper; pub mod io_loop; -use crate::server::video_service::{SCRAP_X11_REF_URL, SCRAP_X11_REQUIRED}; pub static SERVER_KEYBOARD_ENABLED: AtomicBool = AtomicBool::new(true); pub static SERVER_FILE_TRANSFER_ENABLED: AtomicBool = AtomicBool::new(true); pub static SERVER_CLIPBOARD_ENABLED: AtomicBool = AtomicBool::new(true); pub const MILLI1: Duration = Duration::from_millis(1); pub const SEC30: Duration = Duration::from_secs(30); +const SCRAP_X11_REQUIRED: &str = "x11 expected"; +const SCRAP_X11_REF_URL: &str = "https://rustdesk.com/docs/en/manual/linux/#x11-required"; + /// Client of the remote desktop. pub struct Client; diff --git a/src/main.rs b/src/main.rs index 9c7170309..dfb64a7ca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,6 +71,8 @@ fn main() { if options.len() > 3 { remote_host = options[3].clone(); } + common::test_rendezvous_server(); + common::test_nat_type(); let key = matches.value_of("key").unwrap_or("").to_owned(); let token = LocalConfig::get_option("access_token"); cli::start_one_port_forward( @@ -81,6 +83,8 @@ fn main() { key, token, ); + } else if let Some(p) = matches.value_of("server") { + crate::start_server(true); } common::global_clean(); } diff --git a/src/server.rs b/src/server.rs index bbe2d5f2a..4e57d9e46 100644 --- a/src/server.rs +++ b/src/server.rs @@ -26,6 +26,7 @@ use std::{ time::Duration, }; +#[cfg(not(feature = "cli"))] pub mod audio_service; cfg_if::cfg_if! { if #[cfg(not(any(target_os = "android", target_os = "ios")))] { @@ -53,8 +54,14 @@ mod connection; pub mod portable_service; mod service; mod video_qos; +#[cfg(not(feature = "cli"))] pub mod video_service; +#[cfg(feature = "cli")] +mod stub; +#[cfg(feature = "cli")] +pub use stub::*; + use hbb_common::tcp::new_listener; pub type Childs = Arc>>; diff --git a/src/server/video_service.rs b/src/server/video_service.rs index 6d1235ed8..4750ec05f 100644 --- a/src/server/video_service.rs +++ b/src/server/video_service.rs @@ -51,8 +51,6 @@ use virtual_display; pub const SCRAP_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version."; pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str = "Wayland requires higher version of linux distro. Please try X11 desktop or change your OS."; -pub const SCRAP_X11_REQUIRED: &str = "x11 expected"; -pub const SCRAP_X11_REF_URL: &str = "https://rustdesk.com/docs/en/manual/linux/#x11-required"; pub const NAME: &'static str = "video";