Fix the medium toggle in nym-connect (#3590)

This commit is contained in:
Jon Häggblad
2023-06-22 16:30:25 +02:00
committed by GitHub
parent 7be07c29c1
commit a4ffd135e7
2 changed files with 21 additions and 16 deletions
+1 -1
View File
@@ -282,7 +282,7 @@ impl Client {
}
#[derive(Debug, Clone, Copy, Deserialize, PartialEq, Serialize)]
#[serde(default)]
#[serde(default, deny_unknown_fields)]
pub struct Traffic {
/// The parameter of Poisson distribution determining how long, on average,
/// sent packet is going to be delayed at any given mix node.
+20 -15
View File
@@ -44,6 +44,26 @@ pub async fn start_nym_socks5_client(
let mut config = Config::read_from_default_path(id)
.tap_err(|_| log::warn!("Failed to load configuration file"))?;
// Disable both the loop cover traffic that runs in the background as well as the Poisson
// process that injects cover traffic into the traffic stream.
if std::env::var("NYM_CONNECT_DISABLE_COVER").is_ok() {
log::warn!("Disabling cover traffic");
config.core.base.set_no_cover_traffic();
}
if std::env::var("NYM_CONNECT_ENABLE_MIXED_SIZE_PACKETS").is_ok() {
log::warn!("Enabling mixed size packets");
config.core.base.debug.traffic.secondary_packet_size = Some(PacketSize::ExtendedPacket16);
}
if std::env::var("NYM_CONNECT_DISABLE_PER_HOP_DELAYS").is_ok() {
log::warn!("Disabling per-hop delay");
config.core.base.debug.traffic.average_packet_delay = Duration::ZERO;
config.core.base.debug.acknowledgements.average_ack_delay = Duration::ZERO;
}
log::trace!("Configuration used: {:#?}", config);
let storage =
OnDiskPersistent::from_paths(config.storage_paths.common_paths, &config.core.base.debug)
.await?;
@@ -55,21 +75,6 @@ pub async fn start_nym_socks5_client(
.expect("failed to load gateway details")
.into();
// Disable both the loop cover traffic that runs in the background as well as the Poisson
// process that injects cover traffic into the traffic stream.
if std::env::var("NYM_CONNECT_DISABLE_COVER").is_ok() {
config.core.base.set_no_cover_traffic();
}
if std::env::var("NYM_CONNECT_ENABLE_MIXED_SIZE_PACKETS").is_ok() {
config.core.base.debug.traffic.secondary_packet_size = Some(PacketSize::ExtendedPacket16);
}
if std::env::var("NYM_CONNECT_DISABLE_PER_HOP_DELAY").is_ok() {
config.core.base.debug.traffic.average_packet_delay = Duration::ZERO;
config.core.base.debug.acknowledgements.average_ack_delay = Duration::ZERO;
}
log::info!("Starting socks5 client");
// Channel to send control messages to the socks5 client