|
|
@@ -7,8 +7,6 @@ use hbbs::*;
|
|
7
|
7
|
use ini::Ini;
|
|
8
|
8
|
use std::sync::{Arc, Mutex};
|
|
9
|
9
|
|
|
10
|
|
-const LICENSE_KEY: &'static str = "";
|
|
11
|
|
-
|
|
12
|
10
|
fn main() -> ResultType<()> {
|
|
13
|
11
|
init_from_env(Env::default().filter_or(DEFAULT_FILTER_ENV, "info"));
|
|
14
|
12
|
let args = format!(
|
|
|
@@ -17,14 +15,10 @@ fn main() -> ResultType<()> {
|
|
17
|
15
|
-s, --serial=[NUMBER(default=0)] 'Sets configure update serial number'
|
|
18
|
16
|
-R, --rendezvous-servers=[HOSTS] 'Sets rendezvous servers, seperated by colon'
|
|
19
|
17
|
-u, --software-url=[URL] 'Sets download url of RustDesk software of newest version'
|
|
20
|
|
- -r, --relay-server{}=[HOST] 'Sets the default relay server{}'",
|
|
|
18
|
+ -r, --relay-servers=[HOST] 'Sets the default relay servers, seperated by colon, only
|
|
|
19
|
+ available for licensed users'
|
|
|
20
|
+ -k, --key=[KEY] 'Only allow the client with the same key'",
|
|
21
|
21
|
DEFAULT_PORT,
|
|
22
|
|
- if LICENSE_KEY.is_empty() { "" } else { "s" },
|
|
23
|
|
- if LICENSE_KEY.is_empty() {
|
|
24
|
|
- ""
|
|
25
|
|
- } else {
|
|
26
|
|
- "s, seperated by colon, only available for licensed users"
|
|
27
|
|
- }
|
|
28
|
22
|
);
|
|
29
|
23
|
let matches = App::new("hbbs")
|
|
30
|
24
|
.version(crate::VERSION)
|
|
|
@@ -51,21 +45,11 @@ fn main() -> ResultType<()> {
|
|
51
|
45
|
return default.to_owned();
|
|
52
|
46
|
};
|
|
53
|
47
|
let port = get_arg("port", DEFAULT_PORT);
|
|
54
|
|
- let mut relay_servers: Vec<String> = get_arg(
|
|
55
|
|
- &format!(
|
|
56
|
|
- "relay-server{}",
|
|
57
|
|
- if LICENSE_KEY.is_empty() { "" } else { "s" }
|
|
58
|
|
- ),
|
|
59
|
|
- "",
|
|
60
|
|
- )
|
|
61
|
|
- .split(",")
|
|
62
|
|
- .filter(|x| !x.is_empty() && test_if_valid_server(x, "relay-server").is_ok())
|
|
63
|
|
- .map(|x| x.to_owned())
|
|
64
|
|
- .collect();
|
|
65
|
|
- if relay_servers.len() > 1 && LICENSE_KEY.is_empty() {
|
|
66
|
|
- log::error!("Only support multiple relay servers for licenced users");
|
|
67
|
|
- relay_servers = vec![relay_servers[0].clone()];
|
|
68
|
|
- }
|
|
|
48
|
+ let relay_servers: Vec<String> = get_arg("relay-servers", "")
|
|
|
49
|
+ .split(",")
|
|
|
50
|
+ .filter(|x| !x.is_empty() && test_if_valid_server(x, "relay-server").is_ok())
|
|
|
51
|
+ .map(|x| x.to_owned())
|
|
|
52
|
+ .collect();
|
|
69
|
53
|
let serial: i32 = get_arg("serial", "").parse().unwrap_or(0);
|
|
70
|
54
|
let rendezvous_servers: Vec<String> = get_arg("rendezvous-servers", "")
|
|
71
|
55
|
.split(",")
|
|
|
@@ -84,7 +68,7 @@ fn main() -> ResultType<()> {
|
|
84
|
68
|
serial,
|
|
85
|
69
|
rendezvous_servers,
|
|
86
|
70
|
get_arg("software-url", ""),
|
|
87
|
|
- LICENSE_KEY,
|
|
|
71
|
+ &get_arg("key", ""),
|
|
88
|
72
|
stop,
|
|
89
|
73
|
)?;
|
|
90
|
74
|
Ok(())
|