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:
+1
-1
Submodule libs/hbb_common updated: 229b904508...5d52530b63
+5
-1
@@ -68,6 +68,7 @@ use hbb_common::{
|
||||
time::{interval, Duration, Instant},
|
||||
},
|
||||
webrtc::WebRTCStream,
|
||||
websocket::{check_ws, is_ws_endpoint},
|
||||
AddrMangle, ResultType, Stream,
|
||||
};
|
||||
use base::{
|
||||
@@ -1848,8 +1849,11 @@ impl Client {
|
||||
conn_type: ConnType,
|
||||
ipv4: bool,
|
||||
) -> ResultType<Stream> {
|
||||
// The proxy's address family does not constrain the relay target.
|
||||
let relay_server = check_port(relay_server, RELAY_PORT);
|
||||
let use_ws_proxy = Config::is_proxy() && is_ws_endpoint(&check_ws(&relay_server));
|
||||
let mut conn = connect_tcp(
|
||||
ipv4_to_ipv6(check_port(relay_server, RELAY_PORT), ipv4),
|
||||
ipv4_to_ipv6(relay_server, ipv4 || use_ws_proxy),
|
||||
CONNECT_TIMEOUT,
|
||||
)
|
||||
.await
|
||||
|
||||
+7
-2
@@ -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?;
|
||||
|
||||
Reference in New Issue
Block a user