From eb78ac408754ab71412498f55949cb8684dcc945 Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Tue, 28 Jan 2025 11:32:32 +0100 Subject: [PATCH] Enhance mixnet client configuration and add report database path method --- .../statistics-collector/src/mixnet_client.rs | 8 +++++-- .../src/stats_collector.rs | 23 +++++++++---------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/service-providers/statistics-collector/src/mixnet_client.rs b/service-providers/statistics-collector/src/mixnet_client.rs index c1c93572d4..54b220545c 100644 --- a/service-providers/statistics-collector/src/mixnet_client.rs +++ b/service-providers/statistics-collector/src/mixnet_client.rs @@ -1,7 +1,7 @@ // Copyright 2025 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use nym_client_core::{config::disk_persistence::CommonClientPaths, TopologyProvider}; +use nym_client_core::{config::disk_persistence::CommonClientPaths, ForgetMe, TopologyProvider}; use nym_sdk::{GatewayTransceiver, NymNetworkDetails}; use nym_task::TaskClient; @@ -21,10 +21,12 @@ pub async fn create_mixnet_client( ) -> Result { let mut debug_config = config.debug; + //SW do we need cover traffic if we're only gonna receive stuff? debug_config .traffic .disable_main_poisson_packet_distribution = true; debug_config.cover_traffic.disable_loop_cover_traffic_stream = true; + debug_config.stats_reporting.enabled = false; debug_config.topology.ignore_egress_epoch_role = true; //necessary for a fixed address @@ -37,7 +39,9 @@ pub async fn create_mixnet_client( .network_details(NymNetworkDetails::new_from_env()) .debug_config(debug_config) .custom_shutdown(shutdown) - .with_wait_for_gateway(wait_for_gateway); + .with_user_agent(nym_bin_common::bin_info!().into()) + .with_wait_for_gateway(wait_for_gateway) + .with_forget_me(ForgetMe::new_all()); if !config.get_disabled_credentials_mode() { client_builder = client_builder.enable_credentials_mode(); } diff --git a/service-providers/statistics-collector/src/stats_collector.rs b/service-providers/statistics-collector/src/stats_collector.rs index 8393bb3d0a..7a900d5472 100644 --- a/service-providers/statistics-collector/src/stats_collector.rs +++ b/service-providers/statistics-collector/src/stats_collector.rs @@ -4,22 +4,11 @@ use std::path::Path; use nym_client_core::{HardcodedTopologyProvider, TopologyProvider}; -use nym_sdk::{mixnet::Recipient, GatewayTransceiver}; +use nym_sdk::GatewayTransceiver; use nym_task::{TaskClient, TaskHandle}; use crate::{config::Config, error::StatsCollectorError, storage::ClientStatsStorage}; -pub struct OnStartData { - // to add more fields as required - pub address: Recipient, -} - -impl OnStartData { - pub fn new(address: Recipient) -> Self { - Self { address } - } -} - pub struct StatisticsCollector { #[allow(unused)] config: Config, @@ -47,6 +36,16 @@ impl StatisticsCollector { self } + #[must_use] + #[allow(unused)] + pub fn with_report_database_path>( + mut self, + database_path: P, + ) -> Self { + self.config.storage_paths.client_reports_database = database_path.into(); + self + } + #[must_use] #[allow(unused)] pub fn with_wait_for_gateway(mut self, wait_for_gateway: bool) -> Self {