make start_server available in cli

This commit is contained in:
rustdesk 2022-12-29 10:59:17 +08:00
parent cfaeb6ac0a
commit 7dc0c07578
4 changed files with 14 additions and 3 deletions

View File

@ -47,13 +47,15 @@ pub use super::lang::*;
pub mod file_trait; pub mod file_trait;
pub mod helper; pub mod helper;
pub mod io_loop; 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_KEYBOARD_ENABLED: AtomicBool = AtomicBool::new(true);
pub static SERVER_FILE_TRANSFER_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 static SERVER_CLIPBOARD_ENABLED: AtomicBool = AtomicBool::new(true);
pub const MILLI1: Duration = Duration::from_millis(1); pub const MILLI1: Duration = Duration::from_millis(1);
pub const SEC30: Duration = Duration::from_secs(30); 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. /// Client of the remote desktop.
pub struct Client; pub struct Client;

View File

@ -71,6 +71,8 @@ fn main() {
if options.len() > 3 { if options.len() > 3 {
remote_host = options[3].clone(); remote_host = options[3].clone();
} }
common::test_rendezvous_server();
common::test_nat_type();
let key = matches.value_of("key").unwrap_or("").to_owned(); let key = matches.value_of("key").unwrap_or("").to_owned();
let token = LocalConfig::get_option("access_token"); let token = LocalConfig::get_option("access_token");
cli::start_one_port_forward( cli::start_one_port_forward(
@ -81,6 +83,8 @@ fn main() {
key, key,
token, token,
); );
} else if let Some(p) = matches.value_of("server") {
crate::start_server(true);
} }
common::global_clean(); common::global_clean();
} }

View File

@ -26,6 +26,7 @@ use std::{
time::Duration, time::Duration,
}; };
#[cfg(not(feature = "cli"))]
pub mod audio_service; pub mod audio_service;
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(not(any(target_os = "android", target_os = "ios")))] { if #[cfg(not(any(target_os = "android", target_os = "ios")))] {
@ -53,8 +54,14 @@ mod connection;
pub mod portable_service; pub mod portable_service;
mod service; mod service;
mod video_qos; mod video_qos;
#[cfg(not(feature = "cli"))]
pub mod video_service; pub mod video_service;
#[cfg(feature = "cli")]
mod stub;
#[cfg(feature = "cli")]
pub use stub::*;
use hbb_common::tcp::new_listener; use hbb_common::tcp::new_listener;
pub type Childs = Arc<Mutex<Vec<std::process::Child>>>; pub type Childs = Arc<Mutex<Vec<std::process::Child>>>;

View File

@ -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_UBUNTU_HIGHER_REQUIRED: &str = "Wayland requires Ubuntu 21.04 or higher version.";
pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str = pub const SCRAP_OTHER_VERSION_OR_X11_REQUIRED: &str =
"Wayland requires higher version of linux distro. Please try X11 desktop or change your OS."; "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"; pub const NAME: &'static str = "video";