feat: use the configured proxy for WebSocket connections (#16386)

* feat: add opt-in WebSocket proxy support

Add a WebSocket proxy option to the proxy dialog and custom client settings.
Keep WebSocket connections direct by default and use the configured proxy
without direct fallback when enabled.

Preserve relay targets regardless of the proxy address family and restart
connections when the option changes. Update hbb_common for proxy support.

Signed-off-by: 21pages <sunboeasy@gmail.com>

* update hbb_common

Signed-off-by: 21pages <sunboeasy@gmail.com>

* fix: remove WebSocket proxy opt-in

* chore: restore proxy settings UI and translations

* fix: update hbb_common for proxy read progress

* fix: update hbb_common proxy connections and IPv6 parsing

* fix: update hbb_common WebSocket local address

* update to rustdesk/hbb_common

Signed-off-by: 21pages <sunboeasy@gmail.com>

---------

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages authored and GitHub committed 2026-10-14 22:49:35 +08:00
1 parent 256dc9bc12
commit e910029f51
3 files changed
+13 -4

No files matched your search

+7 -2
View File
@@ -21,7 +21,9 @@ use hbb_common::{
rendezvous_proto::*,
socket_client,
sodiumoxide::crypto::{box_, sign},
timeout, tokio, ResultType, Stream,
timeout, tokio,
websocket::{check_ws, is_ws_endpoint},
ResultType, Stream,
};
use base::message_proto::*;
use scrap::camera;
@@ -402,8 +404,11 @@ async fn create_relay_connection_(
ipv4: bool,
meta: ConnectionMeta,
) -> ResultType<()> {
// The proxy's address family does not constrain the relay target.
let relay_server = crate::check_port(relay_server, RELAY_PORT);
let use_ws_proxy = Config::is_proxy() && is_ws_endpoint(&check_ws(&relay_server));
let mut stream = socket_client::connect_tcp(
socket_client::ipv4_to_ipv6(crate::check_port(relay_server, RELAY_PORT), ipv4),
socket_client::ipv4_to_ipv6(relay_server, ipv4 || use_ws_proxy),
CONNECT_TIMEOUT,
)
.await?;