additional clippy fixes
This commit is contained in:
@@ -805,7 +805,7 @@ mod tests {
|
||||
let result = parse_lp_packet(&buf, None);
|
||||
assert!(result.is_err());
|
||||
match result {
|
||||
Err(LpError::DeserializationError(msg)) => {} // Expected error
|
||||
Err(LpError::DeserializationError(_)) => {} // Expected error
|
||||
Err(e) => panic!("Expected DeserializationError, got {:?}", e),
|
||||
Ok(_) => panic!("Expected error, but got Ok"),
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
//! ```ignore
|
||||
//! use nym_lp::kkt_orchestrator::{create_request, process_response, handle_request};
|
||||
//! use nym_lp::message::{KKTRequestData, KKTResponseData};
|
||||
//! use nym-kkt::ciphersuite::{Ciphersuite, KEM, HashFunction, SignatureScheme, EncapsulationKey};
|
||||
//! use nym_kkt::ciphersuite::{Ciphersuite, KEM, HashFunction, SignatureScheme, EncapsulationKey};
|
||||
//!
|
||||
//! // Setup ciphersuite
|
||||
//! let ciphersuite = Ciphersuite::resolve_ciphersuite(
|
||||
|
||||
@@ -7,7 +7,9 @@
|
||||
use super::BitmapOps;
|
||||
|
||||
// Track execution counts for debugging
|
||||
#[cfg(target_feature = "avx2")]
|
||||
static mut AVX2_CLEAR_COUNT: usize = 0;
|
||||
#[cfg(all(target_feature = "sse2", not(target_feature = "avx2")))]
|
||||
static mut SSE2_CLEAR_COUNT: usize = 0;
|
||||
static mut SCALAR_CLEAR_COUNT: usize = 0;
|
||||
|
||||
@@ -21,8 +23,7 @@ use std::arch::x86_64::{
|
||||
|
||||
#[cfg(target_feature = "sse2")]
|
||||
use std::arch::x86_64::{
|
||||
__m128i, _mm_cmpeq_epi64, _mm_loadu_si128, _mm_or_si128, _mm_set1_epi64x, _mm_setzero_si128,
|
||||
_mm_storeu_si128, _mm_testz_si128,
|
||||
__m128i, _mm_loadu_si128, _mm_or_si128, _mm_set1_epi64x, _mm_setzero_si128, _mm_storeu_si128,
|
||||
};
|
||||
|
||||
#[cfg(all(target_feature = "sse2", not(target_feature = "sse4.1")))]
|
||||
@@ -117,6 +118,7 @@ impl BitmapOps for X86BitmapOps {
|
||||
}
|
||||
|
||||
// Scalar fallback
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i in start_idx..(start_idx + num_words) {
|
||||
bitmap[i] = 0;
|
||||
}
|
||||
@@ -162,7 +164,7 @@ impl BitmapOps for X86BitmapOps {
|
||||
let data_vec = _mm_loadu_si128(bitmap[idx..].as_ptr() as *const __m128i);
|
||||
|
||||
// Safety: _mm_testz_si128 is safe when given valid __m128i values
|
||||
if _mm_testz_si128(data_vec, data_vec) == 0 {
|
||||
if std::arch::x86_64::_mm_testz_si128(data_vec, data_vec) == 0 {
|
||||
return false;
|
||||
}
|
||||
idx += 2;
|
||||
@@ -200,7 +202,7 @@ impl BitmapOps for X86BitmapOps {
|
||||
#[cfg(target_feature = "sse4.1")]
|
||||
{
|
||||
// Safety: _mm_testz_si128 is safe when given valid __m128i values
|
||||
if _mm_testz_si128(data_vec, data_vec) == 0 {
|
||||
if std::arch::x86_64::_mm_testz_si128(data_vec, data_vec) == 0 {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -240,21 +242,21 @@ impl BitmapOps for X86BitmapOps {
|
||||
#[inline(always)]
|
||||
fn set_bit(bitmap: &mut [u64], bit_idx: u64) {
|
||||
let word_idx = (bit_idx / 64) as usize;
|
||||
let bit_pos = (bit_idx % 64) as u64;
|
||||
let bit_pos = bit_idx % 64;
|
||||
bitmap[word_idx] |= 1u64 << bit_pos;
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn clear_bit(bitmap: &mut [u64], bit_idx: u64) {
|
||||
let word_idx = (bit_idx / 64) as usize;
|
||||
let bit_pos = (bit_idx % 64) as u64;
|
||||
let bit_pos = bit_idx % 64;
|
||||
bitmap[word_idx] &= !(1u64 << bit_pos);
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
fn check_bit(bitmap: &[u64], bit_idx: u64) -> bool {
|
||||
let word_idx = (bit_idx / 64) as usize;
|
||||
let bit_pos = (bit_idx % 64) as u64;
|
||||
let bit_pos = bit_idx % 64;
|
||||
(bitmap[word_idx] & (1u64 << bit_pos)) != 0
|
||||
}
|
||||
}
|
||||
@@ -268,7 +270,7 @@ pub mod atomic {
|
||||
#[inline(always)]
|
||||
pub fn check_and_set_bit(bitmap: &mut [u64], bit_idx: u64) -> bool {
|
||||
let word_idx = (bit_idx / 64) as usize;
|
||||
let bit_pos = (bit_idx % 64) as u64;
|
||||
let bit_pos = bit_idx % 64;
|
||||
let mask = 1u64 << bit_pos;
|
||||
|
||||
// Get old value
|
||||
@@ -322,7 +324,7 @@ pub mod atomic {
|
||||
}
|
||||
|
||||
// Handle complete words in the middle using AVX2
|
||||
let first_full_word = if start_bit % 64 == 0 {
|
||||
let first_full_word = if start_bit.is_multiple_of(64) {
|
||||
start_word
|
||||
} else {
|
||||
start_word + 1
|
||||
@@ -357,7 +359,7 @@ pub mod atomic {
|
||||
// - We check that i + 2 <= last_full_word + 1 to ensure we have 2 complete words
|
||||
// - The unaligned _loadu/_storeu variants are used to handle any alignment
|
||||
let sse_ones = _mm_set1_epi64x(-1);
|
||||
let current = _mm_loadu_si128(bitmap[i..].as_ptr() as *const __m128i);
|
||||
let current = unsafe { _mm_loadu_si128(bitmap[i..].as_ptr() as *const __m128i) };
|
||||
let result = _mm_or_si128(current, sse_ones);
|
||||
_mm_storeu_si128(bitmap[i..].as_mut_ptr() as *mut __m128i, result);
|
||||
i += 2;
|
||||
@@ -401,23 +403,23 @@ pub mod atomic {
|
||||
}
|
||||
|
||||
// Handle partial words at the beginning and end
|
||||
if start_bit % 64 != 0 {
|
||||
if !start_bit.is_multiple_of(64) {
|
||||
let start_mask = u64::MAX << (start_bit % 64);
|
||||
bitmap[start_word] |= start_mask;
|
||||
}
|
||||
|
||||
if (end_bit + 1) % 64 != 0 {
|
||||
if !(end_bit + 1).is_multiple_of(64) {
|
||||
let end_mask = u64::MAX >> (63 - (end_bit % 64));
|
||||
bitmap[end_word] |= end_mask;
|
||||
}
|
||||
|
||||
// Handle complete words in the middle using SSE2
|
||||
let first_full_word = if start_bit % 64 == 0 {
|
||||
let first_full_word = if start_bit.is_multiple_of(64) {
|
||||
start_word
|
||||
} else {
|
||||
start_word + 1
|
||||
};
|
||||
let last_full_word = if (end_bit + 1) % 64 == 0 {
|
||||
let last_full_word = if (end_bit + 1).is_multiple_of(64) {
|
||||
end_word
|
||||
} else {
|
||||
end_word - 1
|
||||
@@ -434,7 +436,7 @@ pub mod atomic {
|
||||
// - bitmap[i..] is valid for reads/writes of at least 2 u64 words (16 bytes)
|
||||
// - We check that i + 2 <= last_full_word + 1 to ensure we have 2 complete words
|
||||
// - The unaligned _loadu/_storeu variants are used to handle any alignment
|
||||
let current = _mm_loadu_si128(bitmap[i..].as_ptr() as *const __m128i);
|
||||
let current = unsafe { _mm_loadu_si128(bitmap[i..].as_ptr() as *const __m128i) };
|
||||
let result = unsafe { _mm_or_si128(current, ones) };
|
||||
unsafe { _mm_storeu_si128(bitmap[i..].as_mut_ptr() as *mut __m128i, result) };
|
||||
i += 2;
|
||||
@@ -476,7 +478,7 @@ pub mod atomic {
|
||||
}
|
||||
|
||||
// Handle complete words in the middle
|
||||
let first_full_word = if start_bit % 64 == 0 {
|
||||
let first_full_word = if start_bit.is_multiple_of(64) {
|
||||
start_word
|
||||
} else {
|
||||
start_word + 1
|
||||
|
||||
@@ -805,7 +805,7 @@ mod tests {
|
||||
|
||||
// Verify other words are unchanged
|
||||
for i in 4..N_WORDS {
|
||||
assert_eq!(validator.bitmap[i], original_bitmap[i]);
|
||||
assert_eq!(validator.bitmap[i], _original_bitmap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,7 +814,7 @@ mod tests {
|
||||
use std::arch::x86_64::{_mm_setzero_si128, _mm_storeu_si128};
|
||||
|
||||
// Reset validator
|
||||
validator.bitmap = original_bitmap;
|
||||
validator.bitmap = _original_bitmap;
|
||||
|
||||
// Clear words 0-1 using SSE2
|
||||
unsafe {
|
||||
@@ -827,8 +827,9 @@ mod tests {
|
||||
assert_eq!(validator.bitmap[1], 0);
|
||||
|
||||
// Verify other words are unchanged
|
||||
#[allow(clippy::needless_range_loop)]
|
||||
for i in 2..N_WORDS {
|
||||
assert_eq!(validator.bitmap[i], original_bitmap[i]);
|
||||
assert_eq!(validator.bitmap[i], _original_bitmap[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,11 +134,11 @@ mod tests {
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
assert_eq!(empty.take_at_most(0), vec![]);
|
||||
assert_eq!(empty.take_at_most(1), vec![]);
|
||||
assert_eq!(empty.take_at_most(42), vec![]);
|
||||
assert_eq!(empty.take_at_most(0), Vec::<u8>::new());
|
||||
assert_eq!(empty.take_at_most(1), Vec::<u8>::new());
|
||||
assert_eq!(empty.take_at_most(42), Vec::<u8>::new());
|
||||
|
||||
assert_eq!(non_empty.take_at_most(0), vec![]);
|
||||
assert_eq!(non_empty.take_at_most(0), Vec::<u8>::new());
|
||||
assert_eq!(non_empty.take_at_most(1), vec![1]);
|
||||
assert_eq!(non_empty.take_at_most(3), vec![2, 3, 4]);
|
||||
assert_eq!(non_empty.take_at_most(42), vec![5]);
|
||||
|
||||
@@ -12,9 +12,6 @@ use std::sync::Arc;
|
||||
use tokio::sync::mpsc::{self, Receiver, Sender};
|
||||
use tracing::error;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use nym_credential_verification::ecash::EcashManager;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
use nym_ip_packet_requests::IpPair;
|
||||
#[cfg(target_os = "linux")]
|
||||
@@ -228,10 +225,9 @@ pub async fn start_wireguard(
|
||||
);
|
||||
|
||||
info!("Configuring WireGuard interface...");
|
||||
wg_api.configure_interface(&interface_config).map_err(|e| {
|
||||
log::error!("Failed to configure WireGuard interface: {:?}", e);
|
||||
e
|
||||
})?;
|
||||
wg_api
|
||||
.configure_interface(&interface_config)
|
||||
.inspect_err(|e| tracing::error!("Failed to configure WireGuard interface: {:?}", e))?;
|
||||
|
||||
info!("Adding IPv6 address to interface...");
|
||||
std::process::Command::new("ip")
|
||||
@@ -248,10 +244,7 @@ pub async fn start_wireguard(
|
||||
(&ifname),
|
||||
])
|
||||
.output()
|
||||
.map_err(|e| {
|
||||
log::error!("Failed to add IPv6 address: {:?}", e);
|
||||
e
|
||||
})?;
|
||||
.inspect_err(|e| tracing::error!("Failed to add IPv6 address: {:?}", e))?;
|
||||
|
||||
// Use a dummy peer to create routing rule for the entire network space
|
||||
let mut catch_all_peer = Peer::new(Key::new([0; 32]));
|
||||
@@ -291,10 +284,9 @@ pub async fn start_wireguard(
|
||||
.allowed_ips
|
||||
.iter()
|
||||
.find(|ip| matches!(ip.ip, IpAddr::V6(_)))
|
||||
&& let IpAddr::V6(ipv6) = ipv6_mask.ip
|
||||
{
|
||||
if let IpAddr::V6(ipv6) = ipv6_mask.ip {
|
||||
ip_pool.mark_used(IpPair::new(ipv4, ipv6)).await;
|
||||
}
|
||||
ip_pool.mark_used(IpPair::new(ipv4, ipv6)).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,6 +347,9 @@ pub async fn process_registration(
|
||||
|
||||
// Get gateway identity and derive sphinx key
|
||||
let gateway_identity = state.local_identity.public_key().to_bytes();
|
||||
|
||||
warn!("TEMPORARY ed25519 -> x25519 conversion");
|
||||
#[allow(clippy::expect_used)]
|
||||
let gateway_sphinx_key = state
|
||||
.local_identity
|
||||
.public_key()
|
||||
|
||||
@@ -333,7 +333,7 @@ impl GatewayTasksBuilder {
|
||||
active_clients_store,
|
||||
wg_peer_controller,
|
||||
wireguard_data: self.wireguard_data.as_ref().map(|wd| wd.inner.clone()),
|
||||
lp_config: self.config.lp.clone(),
|
||||
lp_config: self.config.lp,
|
||||
outbound_mix_sender: self.mix_packet_sender.clone(),
|
||||
handshake_states: Arc::new(dashmap::DashMap::new()),
|
||||
session_states: Arc::new(dashmap::DashMap::new()),
|
||||
|
||||
@@ -11,7 +11,7 @@ mod tests {
|
||||
use nym_gateway::GatewayError;
|
||||
use nym_gateway::node::lp_listener::handler::LpConnectionHandler;
|
||||
use nym_gateway::node::lp_listener::{
|
||||
LpHandlerState, MixForwardingReceiver, PeerControlRequest, WireguardGatewayData,
|
||||
LpDebug, LpHandlerState, MixForwardingReceiver, PeerControlRequest, WireguardGatewayData,
|
||||
mix_forwarding_channels,
|
||||
};
|
||||
use nym_gateway::node::{ActiveClientsStore, GatewayStorage, LpConfig};
|
||||
@@ -28,6 +28,7 @@ mod tests {
|
||||
use std::mem;
|
||||
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use tokio::sync::Semaphore;
|
||||
use tokio::sync::mpsc::Receiver;
|
||||
use tokio::task::JoinHandle;
|
||||
@@ -81,6 +82,7 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum SpawnedPeerController {
|
||||
Ready { controller: MockPeerController },
|
||||
Running { handle: JoinHandle<Option<()>> },
|
||||
@@ -90,6 +92,7 @@ mod tests {
|
||||
Invalid,
|
||||
}
|
||||
|
||||
#[allow(clippy::large_enum_variant)]
|
||||
enum SpawnedLpConnectionHandlerState {
|
||||
NotCreated,
|
||||
Ready {
|
||||
@@ -176,11 +179,14 @@ mod tests {
|
||||
let ecash_verifier = MockEcashManager::new(Box::new(storage.clone()));
|
||||
|
||||
let lp_config = LpConfig {
|
||||
enabled: true,
|
||||
timestamp_tolerance_secs: 30,
|
||||
debug: LpDebug {
|
||||
timestamp_tolerance: Duration::from_secs(30),
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
let forward_semaphore = Arc::new(Semaphore::new(lp_config.max_concurrent_forwards));
|
||||
let forward_semaphore =
|
||||
Arc::new(Semaphore::new(lp_config.debug.max_concurrent_forwards));
|
||||
|
||||
// Create mix forwarding channel (unused in tests but required by struct)
|
||||
let (mix_sender, mix_receiver) = mix_forwarding_channels();
|
||||
|
||||
@@ -40,7 +40,7 @@ use nym_sdk::mixnet::{
|
||||
};
|
||||
use rand::rngs::OsRng;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use tokio::net::TcpStream;
|
||||
use tokio_util::{codec::Decoder, sync::CancellationToken};
|
||||
use tracing::*;
|
||||
use types::WgProbeResults;
|
||||
@@ -1109,7 +1109,7 @@ where
|
||||
let client_ed25519_keypair = std::sync::Arc::new(ed25519::KeyPair::new(&mut rng));
|
||||
|
||||
// Create LP registration client (uses Ed25519 keys directly, derives X25519 internally)
|
||||
let mut client = LpRegistrationClient::new_with_default_psk(
|
||||
let mut client = LpRegistrationClient::<TcpStream>::new_with_default_psk(
|
||||
client_ed25519_keypair,
|
||||
gateway_identity,
|
||||
gateway_lp_address,
|
||||
@@ -1272,7 +1272,7 @@ where
|
||||
// LpRegistrationClient uses packet-per-connection model - connect() is gone,
|
||||
// connection is established automatically during handshake.
|
||||
info!("Establishing outer LP session with entry gateway...");
|
||||
let mut entry_client = LpRegistrationClient::new_with_default_psk(
|
||||
let mut entry_client = LpRegistrationClient::<TcpStream>::new_with_default_psk(
|
||||
entry_lp_keypair,
|
||||
entry_gateway.identity,
|
||||
entry_lp_address,
|
||||
|
||||
@@ -5,8 +5,8 @@ use crate::TestedNodeDetails;
|
||||
use anyhow::{Context, anyhow, bail};
|
||||
use nym_api_requests::models::{
|
||||
AuthenticatorDetails, DeclaredRoles, DescribedNodeType, HostInformation, IpPacketRouterDetails,
|
||||
NetworkRequesterDetails, NymNodeData, OffsetDateTimeJsonSchemaWrapper, WebSockets,
|
||||
WireguardDetails,
|
||||
LewesProtocolDetails, NetworkRequesterDetails, NymNodeData, OffsetDateTimeJsonSchemaWrapper,
|
||||
WebSockets, WireguardDetails,
|
||||
};
|
||||
use nym_authenticator_requests::AuthenticatorVersion;
|
||||
use nym_bin_common::build_information::BinaryBuildInformationOwned;
|
||||
@@ -204,12 +204,13 @@ pub async fn query_gateway_by_ip(address: String) -> anyhow::Result<DirectoryNod
|
||||
Ok(health) if health.status.is_up() => {
|
||||
info!("Successfully connected to gateway at {}", address);
|
||||
|
||||
// Query all required metadata concurrently
|
||||
// Query all required metadata
|
||||
let host_info_result = client.get_host_information().await;
|
||||
let roles_result = client.get_roles().await;
|
||||
let build_info_result = client.get_build_information().await;
|
||||
let aux_details_result = client.get_auxiliary_details().await;
|
||||
let websockets_result = client.get_mixnet_websockets().await;
|
||||
let lp_result = client.get_lewes_protocol().await;
|
||||
|
||||
// These are optional, so we use ok() to ignore errors
|
||||
let ipr_result = client.get_ip_packet_router().await.ok();
|
||||
@@ -252,6 +253,8 @@ pub async fn query_gateway_by_ip(address: String) -> anyhow::Result<DirectoryNod
|
||||
public_key: wg.public_key,
|
||||
});
|
||||
|
||||
let lp: Option<LewesProtocolDetails> = lp_result.ok().map(Into::into);
|
||||
|
||||
// Construct NymNodeData
|
||||
let node_data = NymNodeData {
|
||||
last_polled: OffsetDateTimeJsonSchemaWrapper(OffsetDateTime::now_utc()),
|
||||
@@ -283,6 +286,7 @@ pub async fn query_gateway_by_ip(address: String) -> anyhow::Result<DirectoryNod
|
||||
ip_packet_router,
|
||||
authenticator,
|
||||
wireguard,
|
||||
lewes_protocol: lp,
|
||||
mixnet_websockets: WebSockets {
|
||||
ws_port: websockets.ws_port,
|
||||
wss_port: websockets.wss_port,
|
||||
|
||||
@@ -394,7 +394,10 @@ pub(crate) async fn run() -> anyhow::Result<ProbeResult> {
|
||||
};
|
||||
|
||||
let test_point = if let Some(node) = args.node {
|
||||
TestedNode::Custom { identity: node }
|
||||
TestedNode::Custom {
|
||||
identity: node,
|
||||
shares_entry: false,
|
||||
}
|
||||
} else {
|
||||
TestedNode::SameAsEntry
|
||||
};
|
||||
|
||||
@@ -27,7 +27,7 @@ fn ephemeral_gateway_config(config: &Config) -> nym_gateway::config::Config {
|
||||
enabled: config.service_providers.network_requester.debug.enabled,
|
||||
},
|
||||
config.gateway_tasks.upgrade_mode.clone(),
|
||||
config.gateway_tasks.lp.clone(),
|
||||
config.gateway_tasks.lp,
|
||||
nym_gateway::config::Debug {
|
||||
client_bandwidth_max_flushing_rate: config
|
||||
.gateway_tasks
|
||||
@@ -227,7 +227,7 @@ pub fn gateway_tasks_config(config: &Config) -> GatewayTasksConfig {
|
||||
ipr_opts: Some(ipr_opts),
|
||||
auth_opts: Some(auth_opts),
|
||||
wg_opts,
|
||||
lp: config.gateway_tasks.lp.clone(),
|
||||
lp: config.gateway_tasks.lp,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// Copyright 2025 - Nym Technologies SA <contact@nymtech.net>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
//! KCP Session Manager for LP clients at the exit gateway.
|
||||
//!
|
||||
//! This module sits between Sphinx unwrapping and IPR message processing.
|
||||
|
||||
@@ -42,7 +42,6 @@ impl NymNode {
|
||||
host: "127.0.0.1".to_string(),
|
||||
custom_http_port: Some(self.http_port),
|
||||
identity_key: self.identity_key.clone(),
|
||||
lp_address: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//! Integrates LP transport with Sphinx routing and KCP framing.
|
||||
//! Supports bidirectional encrypted data channel testing.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
use anyhow::{bail, Context, Result};
|
||||
use bytes::Bytes;
|
||||
use nym_crypto::asymmetric::{ed25519, x25519};
|
||||
@@ -23,7 +25,7 @@ use rand_chacha::ChaCha8Rng;
|
||||
use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
use std::time::{Duration, Instant};
|
||||
use tokio::net::UdpSocket;
|
||||
use tokio::net::{TcpStream, UdpSocket};
|
||||
use tokio_util::bytes::BytesMut;
|
||||
use tokio_util::codec::Encoder;
|
||||
use tracing::{debug, info, trace};
|
||||
@@ -116,7 +118,7 @@ impl SpeedtestClient {
|
||||
|
||||
let client_ip = "0.0.0.0".parse()?;
|
||||
|
||||
let mut lp_client = LpRegistrationClient::new_with_default_psk(
|
||||
let mut lp_client = LpRegistrationClient::<TcpStream>::new_with_default_psk(
|
||||
self.identity_keypair.clone(),
|
||||
self.gateway.identity,
|
||||
self.gateway.lp_address,
|
||||
@@ -157,9 +159,9 @@ impl SpeedtestClient {
|
||||
self.gateway.lp_address
|
||||
);
|
||||
|
||||
let client_ip = "0.0.0.0".parse().unwrap();
|
||||
let client_ip = "0.0.0.0".parse()?;
|
||||
|
||||
let mut lp_client = LpRegistrationClient::new_with_default_psk(
|
||||
let mut lp_client = LpRegistrationClient::<TcpStream>::new_with_default_psk(
|
||||
self.identity_keypair.clone(),
|
||||
self.gateway.identity,
|
||||
self.gateway.lp_address,
|
||||
@@ -315,7 +317,7 @@ impl SpeedtestClient {
|
||||
|
||||
let encryption_keys: Vec<SurbEncryptionKey> = surbs_with_keys
|
||||
.iter()
|
||||
.map(|s| s.encryption_key().clone())
|
||||
.map(|s| *s.encryption_key())
|
||||
.collect();
|
||||
|
||||
// Step 5: Build message (RepliableMessage if SURBs, plain otherwise)
|
||||
@@ -571,7 +573,7 @@ mod tests {
|
||||
|
||||
assert!(result.is_ok(), "sphinx_build failed: {:?}", result.err());
|
||||
let packet = result.unwrap();
|
||||
assert!(packet.len() > 0, "packet should not be empty");
|
||||
assert!(!packet.is_empty(), "packet should not be empty");
|
||||
|
||||
// Verify we can frame it
|
||||
let framed =
|
||||
@@ -585,6 +587,6 @@ mod tests {
|
||||
"framing failed: {:?}",
|
||||
encode_result.err()
|
||||
);
|
||||
assert!(buf.len() > 0, "encoded buffer should not be empty");
|
||||
assert!(!buf.is_empty(), "encoded buffer should not be empty");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//! Echo request/reply for RTT measurement.
|
||||
//! Throughput testing for bandwidth measurement.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
/// Speedtest results
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//! Queries nym-api for active mix nodes and gateways,
|
||||
//! builds routes for Sphinx packet construction.
|
||||
|
||||
#![allow(unused)]
|
||||
|
||||
use anyhow::{anyhow, bail, Context, Result};
|
||||
use nym_api_requests::nym_nodes::SkimmedNode;
|
||||
use nym_crypto::asymmetric::ed25519;
|
||||
@@ -146,7 +148,7 @@ impl SpeedtestTopology {
|
||||
// Build route to the gateway's identity
|
||||
let route = self
|
||||
.topology
|
||||
.random_route_to_egress(rng, gateway.identity.into(), true)
|
||||
.random_route_to_egress(rng, gateway.identity, true)
|
||||
.context("failed to build route to gateway")?;
|
||||
|
||||
if route.is_empty() {
|
||||
|
||||
Reference in New Issue
Block a user