rustdesk-server/src/hbbr.rs

29 lines
848 B
Rust
Raw Normal View History

2020-09-18 17:32:45 +08:00
use clap::App;
2021-03-19 11:50:09 +08:00
mod relay_server;
2021-03-19 16:38:10 +08:00
use hbb_common::{env_logger::*, ResultType};
use relay_server::*;
use std::sync::{Arc, Mutex};
2020-09-18 17:32:45 +08:00
2021-03-19 16:38:10 +08:00
fn main() -> ResultType<()> {
2020-09-18 17:32:45 +08:00
init_from_env(Env::default().filter_or(DEFAULT_FILTER_ENV, "info"));
let args = format!(
2021-03-30 16:01:22 +08:00
"-p, --port=[NUMBER(default={})] 'Sets the listening port'
-k, --key=[KEY] 'Only allow the client with the same key'
",
2020-09-18 17:32:45 +08:00
DEFAULT_PORT
);
let matches = App::new("hbbr")
2020-09-24 17:26:58 +08:00
.version(hbbs::VERSION)
2020-09-24 17:45:38 +08:00
.author("CarrieZ Studio<info@rustdesk.com>")
2020-09-18 17:32:45 +08:00
.about("RustDesk Relay Server")
.args_from_usage(&args)
.get_matches();
2021-03-19 16:38:10 +08:00
let stop: Arc<Mutex<bool>> = Default::default();
2021-03-30 16:01:22 +08:00
start(
matches.value_of("port").unwrap_or(DEFAULT_PORT),
matches.value_of("key").unwrap_or(""),
stop,
)?;
2020-09-18 17:32:45 +08:00
Ok(())
}