@@ -18,7 +18,6 @@ use http::uri::{InvalidUri, PathAndQuery};
18
18
use http:: { HeaderMap , HeaderName , HeaderValue } ;
19
19
use libsignal_net:: auth:: Auth ;
20
20
use libsignal_net:: chat:: fake:: FakeChatRemote ;
21
- use libsignal_net:: chat:: noise:: NoiseDirectConnectShadow ;
22
21
use libsignal_net:: chat:: server_requests:: DisconnectCause ;
23
22
use libsignal_net:: chat:: ws:: ListenerEvent ;
24
23
use libsignal_net:: chat:: {
@@ -32,7 +31,7 @@ use libsignal_net::infra::route::{
32
31
UnresolvedHttpsServiceRoute ,
33
32
} ;
34
33
use libsignal_net:: infra:: tcp_ssl:: InvalidProxyConfig ;
35
- use libsignal_net:: infra:: { Connection as _ , EnableDomainFronting , EnforceMinimumTls } ;
34
+ use libsignal_net:: infra:: { EnableDomainFronting , EnforceMinimumTls } ;
36
35
use libsignal_net_chat:: api:: Unauth ;
37
36
use libsignal_protocol:: Timestamp ;
38
37
use static_assertions:: assert_impl_all;
@@ -144,7 +143,6 @@ impl AuthenticatedChatConnection {
144
143
) ,
145
144
)
146
145
. await ?;
147
-
148
146
Ok ( Self {
149
147
inner : MaybeChatConnection :: WaitingForListener (
150
148
tokio:: runtime:: Handle :: current ( ) ,
@@ -183,39 +181,6 @@ impl AuthenticatedChatConnection {
183
181
}
184
182
}
185
183
186
- fn maybe_shadow < ' a > (
187
- connection_manager : & ' a ConnectionManager ,
188
- remote_config_key : RemoteConfigKey ,
189
- languages : & LanguageList ,
190
- ) -> Option < NoiseDirectConnectShadow < ' a > > {
191
- let ConnectionManager {
192
- user_agent,
193
- env,
194
- remote_config,
195
- connect,
196
- dns_resolver,
197
- ..
198
- } = connection_manager;
199
-
200
- let noise_config = env. chat_noise_config . as_ref ( ) ?. connect ;
201
-
202
- if !remote_config
203
- . lock ( )
204
- . expect ( "not poisoned" )
205
- . is_enabled ( remote_config_key)
206
- {
207
- return None ;
208
- }
209
-
210
- Some ( NoiseDirectConnectShadow {
211
- route_resolver : connect. lock ( ) . expect ( "not poisoned" ) . route_resolver . clone ( ) ,
212
- dns_resolver : dns_resolver. clone ( ) ,
213
- noise_config,
214
- language_list : languages. clone ( ) ,
215
- user_agent,
216
- } )
217
- }
218
-
219
184
impl AsRef < tokio:: sync:: RwLock < MaybeChatConnection > > for AuthenticatedChatConnection {
220
185
fn as_ref ( & self ) -> & tokio:: sync:: RwLock < MaybeChatConnection > {
221
186
& self . inner
@@ -357,21 +322,6 @@ async fn establish_chat_connection(
357
322
connection_manager : & ConnectionManager ,
358
323
headers : Option < chat:: ChatHeaders > ,
359
324
) -> Result < chat:: PendingChatConnection , ConnectError > {
360
- let noise_shadow = headers. as_ref ( ) . and_then ( |headers| {
361
- let ( languages, remote_config) = match headers {
362
- chat:: ChatHeaders :: Auth ( auth) => (
363
- & auth. languages ,
364
- RemoteConfigKey :: ShadowAuthChatWithNoiseDirect ,
365
- ) ,
366
- chat:: ChatHeaders :: Unauth ( unauth) => (
367
- & unauth. languages ,
368
- RemoteConfigKey :: ShadowUnauthChatWithNoiseDirect ,
369
- ) ,
370
- } ;
371
-
372
- maybe_shadow ( connection_manager, remote_config, languages)
373
- } ) ;
374
-
375
325
let ConnectionManager {
376
326
env,
377
327
dns_resolver,
@@ -436,7 +386,7 @@ async fn establish_chat_connection(
436
386
true => EnablePermessageDeflate :: Yes ,
437
387
false => EnablePermessageDeflate :: No ,
438
388
} ;
439
- let connection = ChatConnection :: start_connect_with (
389
+ ChatConnection :: start_connect_with (
440
390
connection_resources,
441
391
route_provider,
442
392
user_agent,
@@ -449,30 +399,7 @@ async fn establish_chat_connection(
449
399
Ok ( _) => log:: info!( "successfully connected {auth_type} chat" ) ,
450
400
Err ( e) => log:: warn!( "failed to connect {auth_type} chat: {e}" ) ,
451
401
} )
452
- . await ?;
453
-
454
- let real_connection_info = connection. connection_info ( ) . route_info ;
455
- let real_connection_was_direct =
456
- real_connection_info. proxy ( ) . is_none ( ) && real_connection_info. domain_front ( ) . is_none ( ) ;
457
-
458
- if let Some ( noise_shadow) = real_connection_was_direct. then_some ( noise_shadow) . flatten ( ) {
459
- log:: info!( "shadowing {auth_type} chat with Noise Direct" ) ;
460
- let connect = noise_shadow. connect ( ) ;
461
- tokio:: spawn ( async move {
462
- match connect. await {
463
- Ok ( stream) => {
464
- let ip_type = stream. transport_info ( ) . ip_version ( ) ;
465
- log:: info!(
466
- "{auth_type} shadow: Noise Direct connection succeeded over IP{ip_type}"
467
- ) ;
468
- drop ( stream) ;
469
- }
470
- Err ( e) => log:: info!( "{auth_type} shadow: Noise Direct connection failed: {e}" ) ,
471
- }
472
- } ) ;
473
- }
474
-
475
- Ok ( connection)
402
+ . await
476
403
}
477
404
478
405
fn make_route_provider (
0 commit comments