Enhance mixnet client configuration and add report database path method
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// Copyright 2025 - Nym Technologies SA <contact@nymtech.net>
|
||||
// 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<nym_sdk::mixnet::MixnetClient, StatsCollectorError> {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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<P: Into<std::path::PathBuf>>(
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user