From 907a62a586461bdc7033c90dc683ada1004e92f4 Mon Sep 17 00:00:00 2001 From: rustdesk Date: Fri, 30 Jun 2023 13:37:51 +0800 Subject: [PATCH] secure request_relay https://github.com/rustdesk/rustdesk/pull/4800 --- src/client.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/client.rs b/src/client.rs index 4bad417a6..d726b713b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -593,12 +593,18 @@ impl Client { let mut succeed = false; let mut uuid = "".to_owned(); let mut ipv4 = true; + for i in 1..=3 { - // use different socket due to current hbbs implement requiring different nat address for each attempt + // use different socket due to current hbbs implementation requiring different nat address for each attempt let mut socket = socket_client::connect_tcp(rendezvous_server, CONNECT_TIMEOUT) .await .with_context(|| "Failed to connect to rendezvous server")?; + if !key.is_empty() && !token.is_empty() { + // mainly for the security of token + allow_err!(secure_punch_connection(&mut socket, key).await); + } + ipv4 = socket.local_addr().is_ipv4(); let mut msg_out = RendezvousMessage::new(); uuid = Uuid::new_v4().to_string();