diff options
author | open-trade <[email protected]> | 2020-09-26 10:57:01 +0800 |
---|---|---|
committer | open-trade <[email protected]> | 2020-09-26 10:57:01 +0800 |
commit | 8d4949232af017b124d8c67741af6b198655d1da (patch) | |
tree | 550312317b6e306ee720eaea9895c79a3661fa22 | |
parent | 1417754b23b855ba415ebd412b176fa3c469b232 (diff) | |
download | rustdesk-server-8d4949232af017b124d8c67741af6b198655d1da.tar.gz rustdesk-server-8d4949232af017b124d8c67741af6b198655d1da.zip |
is_local
m--------- | libs/hbb_common | 0 | ||||
-rw-r--r-- | src/rendezvous_server.rs | 15 |
2 files changed, 10 insertions, 5 deletions
diff --git a/libs/hbb_common b/libs/hbb_common -Subproject 072ae27c89f371f028304b597b08355b91e50dc +Subproject ef0bf8e43ad9017d5b7851ad0f261b6503554e6 diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs index 8d5c6d3..d45489a 100644 --- a/src/rendezvous_server.rs +++ b/src/rendezvous_server.rs @@ -424,13 +424,16 @@ impl RendezvousServer { if relay_server.is_empty() { relay_server = self.relay_server.clone(); } - msg_out.set_punch_hole_response(PunchHoleResponse { + let mut p = PunchHoleResponse { socket_addr: AddrMangle::encode(addr), pk, relay_server, - nat_type: phs.nat_type, ..Default::default() - }); + }; + if let Ok(t) = phs.nat_type.enum_value() { + p.set_nat_type(t); + } + msg_out.set_punch_hole_response(p); if let Some(socket) = socket { socket.send(&msg_out, addr_a).await?; } else { @@ -459,11 +462,13 @@ impl RendezvousServer { if relay_server.is_empty() { relay_server = self.relay_server.clone(); } - msg_out.set_punch_hole_response(PunchHoleResponse { + let mut p = PunchHoleResponse { socket_addr: la.local_addr.clone(), relay_server, ..Default::default() - }); + }; + p.set_is_local(true); + msg_out.set_punch_hole_response(p); if let Some(socket) = socket { socket.send(&msg_out, addr_a).await?; } else { |