diff options
author | nsgundy <[email protected]> | 2023-05-19 15:21:59 +0000 |
---|---|---|
committer | nsgundy <[email protected]> | 2023-05-19 15:21:59 +0000 |
commit | 85a20769fb9754edeeb440191f129b860add5539 (patch) | |
tree | 369277a6bb31ee32e04a4f867ba590dec49972fd | |
parent | aeeca0d7d100436272bb578d693a10cd4064fce2 (diff) | |
download | rustdesk-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.rs | 17 |
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!( |