blob: 00a4f8342ce0965199dfb78e031ff940b9dc1a70 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
use clap::App;
mod common;
mod relay_server;
use flexi_logger::*;
use hbb_common::{config::RELAY_PORT, ResultType};
use relay_server::*;
mod version;
fn main() -> ResultType<()> {
let _logger = Logger::try_with_env_or_str("info")?
.log_to_stdout()
.format(opt_format)
.write_mode(WriteMode::Async)
.start()?;
let args = format!(
"-p, --port=[NUMBER(default={})] 'Sets the listening port'
-k, --key=[KEY] 'Only allow the client with the same key'
",
RELAY_PORT,
);
let matches = App::new("hbbr")
.version(version::VERSION)
.author("Purslane Ltd. <info@rustdesk.com>")
.about("RustDesk Relay Server")
.args_from_usage(&args)
.get_matches();
if let Ok(v) = ini::Ini::load_from_file(".env") {
if let Some(section) = v.section(None::<String>) {
section.iter().for_each(|(k, v)| std::env::set_var(k, v));
}
}
start(
matches.value_of("port").unwrap_or(&RELAY_PORT.to_string()),
matches.value_of("key").unwrap_or(""),
)?;
Ok(())
}
|