mirror of
https://github.com/rustdesk/rustdesk-server.git
synced 2025-07-01 23:35:38 +00:00
change-id option
This commit is contained in:
parent
710f0b2681
commit
92bd9c3250
@ -1 +1 @@
|
|||||||
Subproject commit 4d5b935f16abe33e106b13f30877edb2960f53e9
|
Subproject commit 20bea85903acbd701aed45d195e9206f2ea09edf
|
@ -16,6 +16,7 @@ fn main() -> ResultType<()> {
|
|||||||
-R, --rendezvous-servers=[HOSTS] 'Sets rendezvous servers, seperated by colon'
|
-R, --rendezvous-servers=[HOSTS] 'Sets rendezvous servers, seperated by colon'
|
||||||
-u, --software-url=[URL] 'Sets download url of RustDesk software of newest version'
|
-u, --software-url=[URL] 'Sets download url of RustDesk software of newest version'
|
||||||
-r, --relay-servers=[HOST] 'Sets the default relay servers, seperated by colon'
|
-r, --relay-servers=[HOST] 'Sets the default relay servers, seperated by colon'
|
||||||
|
-C, --change-id=[BOOL(default=Y)] 'Sets if support to change id'
|
||||||
-k, --key=[KEY] 'Only allow the client with the same key'",
|
-k, --key=[KEY] 'Only allow the client with the same key'",
|
||||||
DEFAULT_PORT,
|
DEFAULT_PORT,
|
||||||
);
|
);
|
||||||
@ -50,6 +51,7 @@ fn main() -> ResultType<()> {
|
|||||||
.map(|x| x.to_owned())
|
.map(|x| x.to_owned())
|
||||||
.collect();
|
.collect();
|
||||||
let serial: i32 = get_arg("serial", "").parse().unwrap_or(0);
|
let serial: i32 = get_arg("serial", "").parse().unwrap_or(0);
|
||||||
|
let id_change_support: bool = get_arg("change-id", "Y").to_uppercase() == "Y";
|
||||||
let rendezvous_servers: Vec<String> = get_arg("rendezvous-servers", "")
|
let rendezvous_servers: Vec<String> = get_arg("rendezvous-servers", "")
|
||||||
.split(",")
|
.split(",")
|
||||||
.filter(|x| !x.is_empty() && test_if_valid_server(x, "rendezvous-server").is_ok())
|
.filter(|x| !x.is_empty() && test_if_valid_server(x, "rendezvous-server").is_ok())
|
||||||
@ -69,6 +71,7 @@ fn main() -> ResultType<()> {
|
|||||||
get_arg("software-url", ""),
|
get_arg("software-url", ""),
|
||||||
&get_arg("key", ""),
|
&get_arg("key", ""),
|
||||||
stop,
|
stop,
|
||||||
|
id_change_support,
|
||||||
)?;
|
)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -164,6 +164,7 @@ impl RendezvousServer {
|
|||||||
software_url: String,
|
software_url: String,
|
||||||
key: &str,
|
key: &str,
|
||||||
stop: Arc<Mutex<bool>>,
|
stop: Arc<Mutex<bool>>,
|
||||||
|
id_change_support: bool,
|
||||||
) -> ResultType<()> {
|
) -> ResultType<()> {
|
||||||
if !key.is_empty() {
|
if !key.is_empty() {
|
||||||
log::info!("Key: {}", key);
|
log::info!("Key: {}", key);
|
||||||
@ -171,6 +172,7 @@ impl RendezvousServer {
|
|||||||
log::info!("Listening on tcp/udp {}", addr);
|
log::info!("Listening on tcp/udp {}", addr);
|
||||||
log::info!("Listening on tcp {}, extra port for NAT test", addr2);
|
log::info!("Listening on tcp {}, extra port for NAT test", addr2);
|
||||||
log::info!("relay-servers={:?}", relay_servers);
|
log::info!("relay-servers={:?}", relay_servers);
|
||||||
|
log::info!("change-id={:?}", id_change_support);
|
||||||
let mut socket = FramedSocket::new(addr).await?;
|
let mut socket = FramedSocket::new(addr).await?;
|
||||||
let (tx, mut rx) = mpsc::unbounded_channel::<(RendezvousMessage, SocketAddr)>();
|
let (tx, mut rx) = mpsc::unbounded_channel::<(RendezvousMessage, SocketAddr)>();
|
||||||
let version = hbb_common::get_version_from_url(&software_url);
|
let version = hbb_common::get_version_from_url(&software_url);
|
||||||
@ -202,6 +204,7 @@ impl RendezvousServer {
|
|||||||
&mut socket,
|
&mut socket,
|
||||||
key,
|
key,
|
||||||
stop.clone(),
|
stop.clone(),
|
||||||
|
id_change_support,
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
@ -215,6 +218,7 @@ impl RendezvousServer {
|
|||||||
socket: &mut FramedSocket,
|
socket: &mut FramedSocket,
|
||||||
key: &str,
|
key: &str,
|
||||||
stop: Arc<Mutex<bool>>,
|
stop: Arc<Mutex<bool>>,
|
||||||
|
id_change_support: bool,
|
||||||
) {
|
) {
|
||||||
let mut timer = interval(Duration::from_millis(100));
|
let mut timer = interval(Duration::from_millis(100));
|
||||||
loop {
|
loop {
|
||||||
@ -326,7 +330,9 @@ impl RendezvousServer {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let mut res = register_pk_response::Result::OK;
|
let mut res = register_pk_response::Result::OK;
|
||||||
if let Some(peer) = rs.pm.get(&rk.id).await {
|
if !id_change_support {
|
||||||
|
res = register_pk_response::Result::NOT_SUPPORT;
|
||||||
|
} else if let Some(peer) = rs.pm.get(&rk.id).await {
|
||||||
if peer.uuid != rk.uuid {
|
if peer.uuid != rk.uuid {
|
||||||
res = register_pk_response::Result::ID_EXISTS;
|
res = register_pk_response::Result::ID_EXISTS;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user