Skip to content

Commit

Permalink
Add logging for ephemeral peer negotiation timeouts on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Serock3 committed Dec 20, 2024
1 parent e73a827 commit c2aa8ff
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions talpid-wireguard/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,14 +268,22 @@ impl WireguardMonitor {

let ephemeral_obfs_sender = close_obfs_sender.clone();
if config.quantum_resistant || config.daita {
ephemeral::config_ephemeral_peers(
if let Err(e) = ephemeral::config_ephemeral_peers(
&tunnel,
&mut config,
args.retry_attempt,
obfuscator.clone(),
ephemeral_obfs_sender,
)
.await?;
.await
{
// We have received a small amount of reports about ephemeral peer nogationation
// timing out on Windows for 2024.9-beta1. These verbose data usage logs are
// a temporary measure to help us understand the issue. They can be removed
// if the issue is resolved.
log_tunnel_data_usage(&config, &tunnel).await;
return Err(e);
}

let metadata = Self::tunnel_metadata(&iface_name, &config);
event_hook
Expand Down Expand Up @@ -965,6 +973,25 @@ impl WireguardMonitor {
}
}

async fn log_tunnel_data_usage(config: &Config, tunnel: &Arc<AsyncMutex<Option<Box<dyn Tunnel>>>>) {
let tunnel = tunnel.lock().await;
let Ok(tunnel_stats) = tunnel.as_ref().unwrap().get_tunnel_stats() else {
return;
};
if let Some(stats) = config
.exit_peer
.as_ref()
.map(|peer| peer.public_key.as_bytes())
.and_then(|pubkey| tunnel_stats.get(pubkey))
{
log::warn!("Exit peer stats: {:?}", stats);
};
let pubkey = config.entry_peer.public_key.as_bytes();
if let Some(stats) = tunnel_stats.get(pubkey) {
log::warn!("Entry peer stats: {:?}", stats);
}
}

#[derive(Debug)]
enum CloseMsg {
Stop,
Expand Down

0 comments on commit c2aa8ff

Please sign in to comment.