mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-09-18 18:31:02 +03:00
add enable-webrtc option; gate test_ipv6 under forced relay
OPTION_ENABLE_WEBRTC (hbb_common 48c2d4d) follows the udp/ipv6 punch options end to end: default on against the public server, off against private ones, same settings UI placement on desktop and mobile, and the same bool2option local-option handling. Gates: - controller: should_create_webrtc_offerer checks it first — no pc, no STUN/TURN gathering, no offer in the request; - controlled: unlike the udp/ipv6 legs, which deliberately follow the request, answering builds a pc that gathers ICE from this host, so the answerer honors this machine's own switch too. Translations for "Enable WebRTC P2P connection" added to all 50 lang files next to the IPv6 entry (IPv6 and WebRTC are invariant terms in the same grammatical slot in every one of them). Also stop probing v6 reachability (test_ipv6) under any forced relay: the v6 punch socket is never bound there, so the probe was wasted work on every ws/proxy/relay connection. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ExUfAkYbq8UC9pQCiLy8TQ
This commit is contained in:
@@ -464,7 +464,9 @@ impl Client {
|
||||
}
|
||||
};
|
||||
|
||||
if crate::get_ipv6_punch_enabled() {
|
||||
// Same relay gate as the v6 socket below: under any forced relay the v6 punch cannot
|
||||
// be used, so probing v6 reachability is wasted work on every such connection.
|
||||
if crate::get_ipv6_punch_enabled() && !interface.is_force_relay() {
|
||||
crate::test_ipv6().await;
|
||||
}
|
||||
|
||||
@@ -600,6 +602,9 @@ impl Client {
|
||||
|
||||
/// Whether to build a WebRTC offerer for this connection.
|
||||
///
|
||||
/// Off by default against a private rendezvous server, like the UDP/IPv6 punch options:
|
||||
/// a self-hosted deployment opts in once its server (and TURN, if any) is ready.
|
||||
///
|
||||
/// Skips it when a SOCKS proxy is configured: WebRTC's ICE binds its own UDP sockets and
|
||||
/// speaks STUN directly, which would bypass the proxy policy and can leak the real IP.
|
||||
/// WebSocket mode does NOT skip it: ws only tunnels the signaling/relay legs to the server
|
||||
@@ -620,6 +625,9 @@ impl Client {
|
||||
/// keeps its rendezvous socket for trickle signaling and never reuses it for TCP punching; a
|
||||
/// separate offer-less request provides the TCP fallback when force-relay is not requested.
|
||||
fn should_create_webrtc_offerer(interface: &impl Interface) -> bool {
|
||||
if !crate::get_webrtc_enabled() {
|
||||
return false;
|
||||
}
|
||||
if Config::is_proxy() {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user