2020-03-06 17:18:22 +08:00
|
|
|
// https://tools.ietf.org/rfc/rfc5128.txt
|
|
|
|
// https://blog.csdn.net/bytxl/article/details/44344855
|
|
|
|
|
2020-09-18 13:04:39 +08:00
|
|
|
use clap::App;
|
2020-09-17 10:02:20 +08:00
|
|
|
use hbb_common::{env_logger::*, log, tokio, ResultType};
|
2020-03-06 17:18:22 +08:00
|
|
|
use hbbs::*;
|
2020-09-18 13:04:39 +08:00
|
|
|
const DEFAULT_PORT: &'static str = "21116";
|
2020-03-06 17:18:22 +08:00
|
|
|
|
|
|
|
#[tokio::main]
|
2020-03-09 20:52:54 +08:00
|
|
|
async fn main() -> ResultType<()> {
|
2020-09-17 10:02:20 +08:00
|
|
|
init_from_env(Env::default().filter_or(DEFAULT_FILTER_ENV, "info"));
|
2020-09-18 13:04:39 +08:00
|
|
|
let args = format!(
|
|
|
|
"-p, --port=[default={}] 'Sets the listening port'
|
|
|
|
-r, --relay-server=[] 'Sets the default relay server'",
|
|
|
|
DEFAULT_PORT
|
|
|
|
);
|
|
|
|
let matches = App::new("hbbs")
|
|
|
|
.version("1.0")
|
|
|
|
.author("Zhou Huabing <info@rustdesk.com>")
|
|
|
|
.about("RustDesk Rendezvous Server")
|
|
|
|
.args_from_usage(&args)
|
|
|
|
.get_matches();
|
|
|
|
let addr = format!(
|
|
|
|
"0.0.0.0:{}",
|
|
|
|
matches.value_of("port").unwrap_or(DEFAULT_PORT)
|
|
|
|
);
|
2020-09-17 00:04:39 +08:00
|
|
|
log::info!("Listening on {}", addr);
|
2020-09-18 13:04:39 +08:00
|
|
|
RendezvousServer::start(
|
|
|
|
&addr,
|
|
|
|
matches.value_of("relay-server").unwrap_or("").to_owned(),
|
|
|
|
)
|
|
|
|
.await?;
|
2020-03-06 17:18:22 +08:00
|
|
|
Ok(())
|
2020-03-09 19:35:57 +08:00
|
|
|
}
|