aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsgundy <[email protected]>2023-05-19 15:21:59 +0000
committernsgundy <[email protected]>2023-05-19 15:21:59 +0000
commit85a20769fb9754edeeb440191f129b860add5539 (patch)
tree369277a6bb31ee32e04a4f867ba590dec49972fd
parentaeeca0d7d100436272bb578d693a10cd4064fce2 (diff)
downloadrustdesk-server-85a20769fb9754edeeb440191f129b860add5539.tar.gz
rustdesk-server-85a20769fb9754edeeb440191f129b860add5539.zip
Consider peers to be on same intranet if is_lan() returns true for both
-rw-r--r--src/rendezvous_server.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/rendezvous_server.rs b/src/rendezvous_server.rs
index 5aba4d4..931b1df 100644
--- a/src/rendezvous_server.rs
+++ b/src/rendezvous_server.rs
@@ -706,17 +706,14 @@ impl RendezvousServer {
}
ph.nat_type = NatType::SYMMETRIC.into(); // will force relay
}
- let same_intranet = !ws
- && match peer_addr {
- SocketAddr::V4(a) => match addr {
- SocketAddr::V4(b) => a.ip() == b.ip(),
+ let same_intranet: bool = !ws
+ && (peer_is_lan && is_lan || {
+ match (peer_addr, addr) {
+ (SocketAddr::V4(a), SocketAddr::V4(b)) => a.ip() == b.ip(),
+ (SocketAddr::V6(a), SocketAddr::V6(b)) => a.ip() == b.ip(),
_ => false,
- },
- SocketAddr::V6(a) => match addr {
- SocketAddr::V6(b) => a.ip() == b.ip(),
- _ => false,
- },
- };
+ }
+ });
let socket_addr = AddrMangle::encode(addr).into();
if same_intranet {
log::debug!(