From 8c29fba5ef4e69d15f42bb95b7e8d46b8aa3696f Mon Sep 17 00:00:00 2001 From: Simon Wicky Date: Tue, 6 Feb 2024 09:45:37 +0100 Subject: [PATCH] move topology control into its own crate --- Cargo.lock | 28 +++++++++++++-- clients/socks5/Cargo.toml | 1 + clients/socks5/src/commands/mod.rs | 4 +-- clients/socks5/src/commands/run.rs | 2 +- common/client-core/Cargo.toml | 1 + .../client-core/src/client/base_client/mod.rs | 8 ++--- .../src/client/cover_traffic_stream.rs | 2 +- common/client-core/src/client/mod.rs | 1 - .../real_messages_control/message_handler.rs | 2 +- .../src/client/real_messages_control/mod.rs | 2 +- .../real_traffic_stream.rs | 2 +- common/client-core/src/config/mod.rs | 24 ++----------- .../src/config/old_config_v1_1_30.rs | 6 ++-- common/topology-control/Cargo.toml | 34 +++++++++++++++++++ .../src}/accessor.rs | 2 +- .../src}/geo_aware_provider.rs | 19 +++++++++-- .../mod.rs => topology-control/src/lib.rs} | 6 ++-- .../src}/nym_api_provider.rs | 0 gateway/Cargo.toml | 2 +- gateway/src/node/mod.rs | 8 ++--- mixnode/Cargo.toml | 2 +- mixnode/src/node/mod.rs | 8 ++--- sdk/rust/nym-sdk/Cargo.toml | 1 + sdk/rust/nym-sdk/src/mixnet.rs | 6 ++-- 24 files changed, 114 insertions(+), 57 deletions(-) create mode 100644 common/topology-control/Cargo.toml rename common/{client-core/src/client/topology_control => topology-control/src}/accessor.rs (99%) rename common/{client-core/src/client/topology_control => topology-control/src}/geo_aware_provider.rs (95%) rename common/{client-core/src/client/topology_control/mod.rs => topology-control/src/lib.rs} (97%) rename common/{client-core/src/client/topology_control => topology-control/src}/nym_api_provider.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 75a4c2ed9a..e3d0413847 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6240,6 +6240,7 @@ dependencies = [ "nym-sphinx", "nym-task", "nym-topology", + "nym-topology-control", "nym-validator-client", "rand 0.7.3", "reqwest", @@ -6547,7 +6548,6 @@ dependencies = [ "log", "nym-api-requests", "nym-bin-common", - "nym-client-core", "nym-coconut-interface", "nym-config", "nym-credentials", @@ -6564,6 +6564,7 @@ dependencies = [ "nym-statistics-common", "nym-task", "nym-topology", + "nym-topology-control", "nym-types", "nym-validator-client", "nym-wireguard", @@ -6754,7 +6755,6 @@ dependencies = [ "lazy_static", "log", "nym-bin-common", - "nym-client-core", "nym-config", "nym-contracts-common", "nym-crypto", @@ -6768,6 +6768,7 @@ dependencies = [ "nym-sphinx-types", "nym-task", "nym-topology", + "nym-topology-control", "nym-types", "nym-validator-client", "opentelemetry", @@ -7106,6 +7107,7 @@ dependencies = [ "nym-sphinx", "nym-task", "nym-topology", + "nym-topology-control", "nym-validator-client", "parking_lot 0.12.1", "pretty_env_logger", @@ -7171,6 +7173,7 @@ dependencies = [ "nym-socks5-client-core", "nym-sphinx", "nym-topology", + "nym-topology-control", "pretty_env_logger", "rand 0.7.3", "serde", @@ -7483,6 +7486,27 @@ dependencies = [ "wasm-utils", ] +[[package]] +name = "nym-topology-control" +version = "1.1.15" +dependencies = [ + "async-trait", + "futures", + "log", + "nym-explorer-client", + "nym-network-defaults", + "nym-sphinx", + "nym-task", + "nym-topology", + "nym-validator-client", + "rand 0.7.3", + "serde", + "tap", + "tokio", + "tokio-stream", + "url", +] + [[package]] name = "nym-tun" version = "0.1.0" diff --git a/clients/socks5/Cargo.toml b/clients/socks5/Cargo.toml index 72a94c4c2d..810f53488d 100644 --- a/clients/socks5/Cargo.toml +++ b/clients/socks5/Cargo.toml @@ -34,6 +34,7 @@ nym-sphinx = { path = "../../common/nymsphinx" } nym-ordered-buffer = { path = "../../common/socks5/ordered-buffer" } nym-pemstore = { path = "../../common/pemstore" } nym-topology = { path = "../../common/topology" } +nym-topology-control = { path = "../../common/topology-control" } nym-socks5-client-core = { path = "../../common/socks5-client-core" } [features] diff --git a/clients/socks5/src/commands/mod.rs b/clients/socks5/src/commands/mod.rs index 7bd5205791..dcda28fb3d 100644 --- a/clients/socks5/src/commands/mod.rs +++ b/clients/socks5/src/commands/mod.rs @@ -17,11 +17,11 @@ use nym_client_core::client::base_client::storage::gateway_details::{ OnDiskGatewayDetails, PersistedGatewayDetails, }; use nym_client_core::client::key_manager::persistence::OnDiskKeys; -use nym_client_core::client::topology_control::geo_aware_provider::CountryGroup; -use nym_client_core::config::{GatewayEndpointConfig, GroupBy, TopologyStructure}; +use nym_client_core::config::{GatewayEndpointConfig, TopologyStructure}; use nym_client_core::error::ClientCoreError; use nym_config::OptionalSet; use nym_sphinx::params::{PacketSize, PacketType}; +use nym_topology_control::geo_aware_provider::{CountryGroup, GroupBy}; use std::error::Error; use std::net::IpAddr; diff --git a/clients/socks5/src/commands/run.rs b/clients/socks5/src/commands/run.rs index 5638c80d9b..edb1c6ec87 100644 --- a/clients/socks5/src/commands/run.rs +++ b/clients/socks5/src/commands/run.rs @@ -12,9 +12,9 @@ use log::*; use nym_bin_common::version_checker::is_minor_version_compatible; use nym_client_core::cli_helpers::client_run::CommonClientRunArgs; use nym_client_core::client::base_client::storage::OnDiskPersistent; -use nym_client_core::client::topology_control::geo_aware_provider::CountryGroup; use nym_socks5_client_core::NymClient; use nym_sphinx::addressing::clients::Recipient; +use nym_topology_control::geo_aware_provider::CountryGroup; use std::net::IpAddr; #[derive(Args, Clone)] diff --git a/common/client-core/Cargo.toml b/common/client-core/Cargo.toml index dc6c9bba2b..a9776ff911 100644 --- a/common/client-core/Cargo.toml +++ b/common/client-core/Cargo.toml @@ -42,6 +42,7 @@ nym-nonexhaustive-delayqueue = { path = "../nonexhaustive-delayqueue" } nym-sphinx = { path = "../nymsphinx" } nym-pemstore = { path = "../pemstore" } nym-topology = { path = "../topology", features = ["serializable"] } +nym-topology-control = { path = "../topology-control" } nym-validator-client = { path = "../client-libs/validator-client", default-features = false } nym-task = { path = "../task" } nym-credential-storage = { path = "../credential-storage" } diff --git a/common/client-core/src/client/base_client/mod.rs b/common/client-core/src/client/base_client/mod.rs index 47b119261a..56e33c2aa5 100644 --- a/common/client-core/src/client/base_client/mod.rs +++ b/common/client-core/src/client/base_client/mod.rs @@ -3,7 +3,6 @@ use super::packet_statistics_control::PacketStatisticsReporter; use super::received_buffer::ReceivedBufferMessage; -use super::topology_control::geo_aware_provider::GeoAwareTopologyProvider; use crate::client::base_client::storage::gateway_details::GatewayDetailsStore; use crate::client::base_client::storage::MixnetClientStorage; use crate::client::cover_traffic_stream::LoopCoverTrafficStream; @@ -22,10 +21,6 @@ use crate::client::replies::reply_controller::{ReplyControllerReceiver, ReplyCon use crate::client::replies::reply_storage::{ CombinedReplyStorage, PersistentReplyStorage, ReplyStorageBackend, SentReplyKeys, }; -use crate::client::topology_control::nym_api_provider::NymApiTopologyProvider; -use crate::client::topology_control::{ - TopologyAccessor, TopologyRefresher, TopologyRefresherConfig, -}; use crate::config::{Config, DebugConfig}; use crate::error::ClientCoreError; use crate::init::{ @@ -50,6 +45,9 @@ use nym_task::connections::{ConnectionCommandReceiver, ConnectionCommandSender, use nym_task::{TaskClient, TaskHandle}; use nym_topology::provider_trait::TopologyProvider; use nym_topology::HardcodedTopologyProvider; +use nym_topology_control::geo_aware_provider::GeoAwareTopologyProvider; +use nym_topology_control::nym_api_provider::NymApiTopologyProvider; +use nym_topology_control::{TopologyAccessor, TopologyRefresher, TopologyRefresherConfig}; use nym_validator_client::nyxd::contract_traits::DkgQueryClient; use std::fmt::Debug; use std::path::Path; diff --git a/common/client-core/src/client/cover_traffic_stream.rs b/common/client-core/src/client/cover_traffic_stream.rs index 101a0a7754..d650fb16f9 100644 --- a/common/client-core/src/client/cover_traffic_stream.rs +++ b/common/client-core/src/client/cover_traffic_stream.rs @@ -3,7 +3,6 @@ use crate::client::mix_traffic::BatchMixMessageSender; use crate::client::packet_statistics_control::{PacketStatisticsEvent, PacketStatisticsReporter}; -use crate::client::topology_control::TopologyAccessor; use crate::{config, spawn_future}; use futures::task::{Context, Poll}; use futures::{Future, Stream, StreamExt}; @@ -13,6 +12,7 @@ use nym_sphinx::addressing::clients::Recipient; use nym_sphinx::cover::generate_loop_cover_packet; use nym_sphinx::params::{PacketSize, PacketType}; use nym_sphinx::utils::sample_poisson_duration; +use nym_topology_control::TopologyAccessor; use rand::{rngs::OsRng, CryptoRng, Rng}; use std::pin::Pin; use std::sync::Arc; diff --git a/common/client-core/src/client/mod.rs b/common/client-core/src/client/mod.rs index 9a3a3a33c9..93340e50cf 100644 --- a/common/client-core/src/client/mod.rs +++ b/common/client-core/src/client/mod.rs @@ -11,5 +11,4 @@ pub(crate) mod packet_statistics_control; pub mod real_messages_control; pub mod received_buffer; pub mod replies; -pub mod topology_control; pub(crate) mod transmission_buffer; diff --git a/common/client-core/src/client/real_messages_control/message_handler.rs b/common/client-core/src/client/real_messages_control/message_handler.rs index 42a1993844..11bb514c66 100644 --- a/common/client-core/src/client/real_messages_control/message_handler.rs +++ b/common/client-core/src/client/real_messages_control/message_handler.rs @@ -7,7 +7,6 @@ use crate::client::real_messages_control::real_traffic_stream::{ }; use crate::client::real_messages_control::{AckActionSender, Action}; use crate::client::replies::reply_storage::{ReceivedReplySurbsMap, SentReplyKeys, UsedSenderTags}; -use crate::client::topology_control::{TopologyAccessor, TopologyReadPermit}; use log::{debug, error, info, trace, warn}; use nym_sphinx::acknowledgements::AckKey; use nym_sphinx::addressing::clients::Recipient; @@ -20,6 +19,7 @@ use nym_sphinx::preparer::{MessagePreparer, PreparedFragment}; use nym_sphinx::Delay; use nym_task::connections::TransmissionLane; use nym_topology::{NymTopology, NymTopologyError}; +use nym_topology_control::{TopologyAccessor, TopologyReadPermit}; use rand::{CryptoRng, Rng}; use std::collections::HashMap; use std::sync::Arc; diff --git a/common/client-core/src/client/real_messages_control/mod.rs b/common/client-core/src/client/real_messages_control/mod.rs index d4914f1440..1aef76ebe7 100644 --- a/common/client-core/src/client/real_messages_control/mod.rs +++ b/common/client-core/src/client/real_messages_control/mod.rs @@ -17,7 +17,6 @@ use crate::{ client::{ inbound_messages::InputMessageReceiver, mix_traffic::BatchMixMessageSender, real_messages_control::acknowledgement_control::AcknowledgementControllerConnectors, - topology_control::TopologyAccessor, }, spawn_future, }; @@ -28,6 +27,7 @@ use nym_sphinx::acknowledgements::AckKey; use nym_sphinx::addressing::clients::Recipient; use nym_sphinx::params::PacketType; use nym_task::connections::{ConnectionCommandReceiver, LaneQueueLengths}; +use nym_topology_control::TopologyAccessor; use rand::{rngs::OsRng, CryptoRng, Rng}; use std::sync::Arc; diff --git a/common/client-core/src/client/real_messages_control/real_traffic_stream.rs b/common/client-core/src/client/real_messages_control/real_traffic_stream.rs index ef91208f1b..a742b20e20 100644 --- a/common/client-core/src/client/real_messages_control/real_traffic_stream.rs +++ b/common/client-core/src/client/real_messages_control/real_traffic_stream.rs @@ -5,7 +5,6 @@ use self::sending_delay_controller::SendingDelayController; use crate::client::mix_traffic::BatchMixMessageSender; use crate::client::packet_statistics_control::{PacketStatisticsEvent, PacketStatisticsReporter}; use crate::client::real_messages_control::acknowledgement_control::SentPacketNotificationSender; -use crate::client::topology_control::TopologyAccessor; use crate::client::transmission_buffer::TransmissionBuffer; use crate::config; use futures::task::{Context, Poll}; @@ -22,6 +21,7 @@ use nym_sphinx::utils::sample_poisson_duration; use nym_task::connections::{ ConnectionCommand, ConnectionCommandReceiver, ConnectionId, LaneQueueLengths, TransmissionLane, }; +use nym_topology_control::TopologyAccessor; use rand::{CryptoRng, Rng}; use std::pin::Pin; use std::sync::Arc; diff --git a/common/client-core/src/config/mod.rs b/common/client-core/src/config/mod.rs index 3f4bbb4efe..a52b5f8c4d 100644 --- a/common/client-core/src/config/mod.rs +++ b/common/client-core/src/config/mod.rs @@ -1,14 +1,12 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::{client::topology_control::geo_aware_provider::CountryGroup, error::ClientCoreError}; +use crate::error::ClientCoreError; use nym_config::defaults::NymNetworkDetails; use nym_crypto::asymmetric::identity; use nym_gateway_client::client::GatewayConfig; -use nym_sphinx::{ - addressing::clients::Recipient, - params::{PacketSize, PacketType}, -}; +use nym_sphinx::params::{PacketSize, PacketType}; +use nym_topology_control::geo_aware_provider::GroupBy; use serde::{Deserialize, Serialize}; use std::time::Duration; use url::Url; @@ -541,22 +539,6 @@ pub enum TopologyStructure { GeoAware(GroupBy), } -#[allow(clippy::large_enum_variant)] -#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] -pub enum GroupBy { - CountryGroup(CountryGroup), - NymAddress(Recipient), -} - -impl std::fmt::Display for GroupBy { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - GroupBy::CountryGroup(group) => write!(f, "group: {}", group), - GroupBy::NymAddress(address) => write!(f, "address: {}", address), - } - } -} - impl Default for Topology { fn default() -> Self { Topology { diff --git a/common/client-core/src/config/old_config_v1_1_30.rs b/common/client-core/src/config/old_config_v1_1_30.rs index 87dae0eb3f..607fabc7f7 100644 --- a/common/client-core/src/config/old_config_v1_1_30.rs +++ b/common/client-core/src/config/old_config_v1_1_30.rs @@ -1,15 +1,15 @@ // Copyright 2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::client::topology_control::geo_aware_provider::CountryGroup; use crate::config::{ - Acknowledgements, Client, Config, CoverTraffic, DebugConfig, GatewayConnection, GroupBy, - ReplySurbs, Topology, TopologyStructure, Traffic, + Acknowledgements, Client, Config, CoverTraffic, DebugConfig, GatewayConnection, ReplySurbs, + Topology, TopologyStructure, Traffic, }; use nym_sphinx::{ addressing::clients::Recipient, params::{PacketSize, PacketType}, }; +use nym_topology_control::geo_aware_provider::{CountryGroup, GroupBy}; use serde::{Deserialize, Serialize}; use std::time::Duration; use url::Url; diff --git a/common/topology-control/Cargo.toml b/common/topology-control/Cargo.toml new file mode 100644 index 0000000000..016c21b748 --- /dev/null +++ b/common/topology-control/Cargo.toml @@ -0,0 +1,34 @@ +[package] +name = "nym-topology-control" +version = "1.1.15" +authors = ["Dave Hrycyszyn "] +edition = "2021" +rust-version = "1.66" +license.workspace = true + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +async-trait = { workspace = true } +futures = { workspace = true } +log = { workspace = true } +rand = { version = "0.7.3", features = ["wasm-bindgen"] } +serde = { workspace = true, features = ["derive"] } +tap = "1.0.1" +url = { workspace = true, features = ["serde"] } +tokio = { workspace = true, features = ["macros"]} + +# internal + +nym-explorer-client = { path = "../../explorer-api/explorer-client" } +nym-sphinx = { path = "../nymsphinx" } +nym-topology = { path = "../topology", features = ["serializable"] } +nym-validator-client = { path = "../client-libs/validator-client", default-features = false } +nym-task = { path = "../task" } +nym-network-defaults = { path = "../network-defaults" } + + +[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio-stream] +version = "0.1.11" +features = ["time"] + diff --git a/common/client-core/src/client/topology_control/accessor.rs b/common/topology-control/src/accessor.rs similarity index 99% rename from common/client-core/src/client/topology_control/accessor.rs rename to common/topology-control/src/accessor.rs index f4b50be059..da463a4e91 100644 --- a/common/client-core/src/client/topology_control/accessor.rs +++ b/common/topology-control/src/accessor.rs @@ -49,7 +49,7 @@ impl<'a> Deref for TopologyReadPermit<'a> { impl<'a> TopologyReadPermit<'a> { /// Using provided topology read permit, tries to get an immutable reference to the underlying /// topology. For obvious reasons the lifetime of the topology reference is bound to the permit. - pub(crate) fn try_get_valid_topology_ref( + pub fn try_get_valid_topology_ref( &'a self, ack_recipient: &Recipient, packet_recipient: Option<&Recipient>, diff --git a/common/client-core/src/client/topology_control/geo_aware_provider.rs b/common/topology-control/src/geo_aware_provider.rs similarity index 95% rename from common/client-core/src/client/topology_control/geo_aware_provider.rs rename to common/topology-control/src/geo_aware_provider.rs index 71de0327b5..d61309a755 100644 --- a/common/client-core/src/client/topology_control/geo_aware_provider.rs +++ b/common/topology-control/src/geo_aware_provider.rs @@ -3,6 +3,7 @@ use std::{collections::HashMap, fmt}; use log::{debug, error, info}; use nym_explorer_client::{ExplorerClient, PrettyDetailedMixNodeBond}; use nym_network_defaults::var_names::EXPLORER_API; +use nym_sphinx::addressing::clients::Recipient; use nym_topology::{ nym_topology_from_detailed, provider_trait::{async_trait, TopologyProvider}, @@ -14,8 +15,6 @@ use serde::{Deserialize, Serialize}; use tap::TapOptional; use url::Url; -use crate::config::GroupBy; - const MIN_NODES_PER_LAYER: usize = 1; fn create_explorer_client() -> Option { @@ -38,6 +37,22 @@ fn create_explorer_client() -> Option { Some(client) } +#[allow(clippy::large_enum_variant)] +#[derive(Copy, Clone, Debug, PartialEq, Serialize, Deserialize)] +pub enum GroupBy { + CountryGroup(CountryGroup), + NymAddress(Recipient), +} + +impl std::fmt::Display for GroupBy { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + GroupBy::CountryGroup(group) => write!(f, "group: {}", group), + GroupBy::NymAddress(address) => write!(f, "address: {}", address), + } + } +} + #[derive(Copy, Clone, Hash, PartialEq, Eq, Serialize, Deserialize, Debug)] pub enum CountryGroup { Europe, diff --git a/common/client-core/src/client/topology_control/mod.rs b/common/topology-control/src/lib.rs similarity index 97% rename from common/client-core/src/client/topology_control/mod.rs rename to common/topology-control/src/lib.rs index fa54a0ca7f..ead03a8c0b 100644 --- a/common/client-core/src/client/topology_control/mod.rs +++ b/common/topology-control/src/lib.rs @@ -1,11 +1,11 @@ // Copyright 2021-2023 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::spawn_future; -pub(crate) use accessor::{TopologyAccessor, TopologyReadPermit}; +pub use accessor::{TopologyAccessor, TopologyReadPermit}; use futures::StreamExt; use log::*; use nym_sphinx::addressing::nodes::NodeIdentity; +use nym_task::spawn; use nym_topology::provider_trait::TopologyProvider; use nym_topology::NymTopologyError; use std::time::Duration; @@ -142,7 +142,7 @@ impl TopologyRefresher { } pub fn start_with_shutdown(mut self, mut shutdown: nym_task::TaskClient) { - spawn_future(async move { + spawn(async move { debug!("Started TopologyRefresher with graceful shutdown support"); #[cfg(not(target_arch = "wasm32"))] diff --git a/common/client-core/src/client/topology_control/nym_api_provider.rs b/common/topology-control/src/nym_api_provider.rs similarity index 100% rename from common/client-core/src/client/topology_control/nym_api_provider.rs rename to common/topology-control/src/nym_api_provider.rs diff --git a/gateway/Cargo.toml b/gateway/Cargo.toml index 4743d52add..2e62aec499 100644 --- a/gateway/Cargo.toml +++ b/gateway/Cargo.toml @@ -78,7 +78,7 @@ nym-task = { path = "../common/task" } nym-types = { path = "../common/types" } nym-validator-client = { path = "../common/client-libs/validator-client" } nym-ip-packet-router = { path = "../service-providers/ip-packet-router" } -nym-client-core = { path = "../common/client-core"} +nym-topology-control = { path = "../common/topology-control" } nym-topology = { path = "../common/topology" } nym-wireguard = { path = "../common/wireguard", optional = true } diff --git a/gateway/src/node/mod.rs b/gateway/src/node/mod.rs index 21a98a92ef..b65a64800f 100644 --- a/gateway/src/node/mod.rs +++ b/gateway/src/node/mod.rs @@ -24,10 +24,6 @@ use anyhow::bail; use dashmap::DashMap; use futures::channel::{mpsc, oneshot}; use log::*; -use nym_client_core::client::topology_control::accessor::TopologyAccessor; -use nym_client_core::client::topology_control::nym_api_provider::NymApiTopologyProvider; -use nym_client_core::client::topology_control::TopologyRefresher; -use nym_client_core::client::topology_control::TopologyRefresherConfig; use nym_crypto::asymmetric::{encryption, identity}; use nym_mixnet_client::forwarder::{MixForwardingSender, PacketForwarder}; use nym_network_defaults::NymNetworkDetails; @@ -36,6 +32,10 @@ use nym_node::wireguard::types::GatewayClientRegistry; use nym_statistics_common::collector::StatisticsSender; use nym_task::{TaskClient, TaskManager}; use nym_topology::provider_trait::TopologyProvider; +use nym_topology_control::accessor::TopologyAccessor; +use nym_topology_control::nym_api_provider::NymApiTopologyProvider; +use nym_topology_control::TopologyRefresher; +use nym_topology_control::TopologyRefresherConfig; use nym_validator_client::{nyxd, DirectSigningHttpRpcNyxdClient}; use rand::seq::SliceRandom; use rand::thread_rng; diff --git a/mixnode/Cargo.toml b/mixnode/Cargo.toml index 7597e19177..d7fca9ca14 100644 --- a/mixnode/Cargo.toml +++ b/mixnode/Cargo.toml @@ -59,7 +59,7 @@ nym-pemstore = { path = "../common/pemstore", version = "0.3.0" } nym-task = { path = "../common/task" } nym-types = { path = "../common/types" } nym-topology = { path = "../common/topology" } -nym-client-core = { path = "../common/client-core/" } +nym-topology-control = { path = "../common/topology-control" } nym-validator-client = { path = "../common/client-libs/validator-client" } nym-bin-common = { path = "../common/bin-common", features = ["output_format"] } cpu-cycles = { path = "../cpu-cycles", optional = true } diff --git a/mixnode/src/node/mod.rs b/mixnode/src/node/mod.rs index ee9567f7e9..a990b98b4a 100644 --- a/mixnode/src/node/mod.rs +++ b/mixnode/src/node/mod.rs @@ -15,14 +15,14 @@ use crate::node::packet_delayforwarder::{DelayForwarder, PacketDelayForwardSende use log::{error, info, warn}; use nym_bin_common::output_format::OutputFormat; use nym_bin_common::version_checker::parse_version; -use nym_client_core::client::topology_control::accessor::TopologyAccessor; -use nym_client_core::client::topology_control::nym_api_provider::NymApiTopologyProvider; -use nym_client_core::client::topology_control::TopologyRefresher; -use nym_client_core::client::topology_control::TopologyRefresherConfig; use nym_crypto::asymmetric::{encryption, identity}; use nym_mixnode_common::verloc::{self, AtomicVerlocResult, VerlocMeasurer}; use nym_task::{TaskClient, TaskManager}; use nym_topology::provider_trait::TopologyProvider; +use nym_topology_control::accessor::TopologyAccessor; +use nym_topology_control::nym_api_provider::NymApiTopologyProvider; +use nym_topology_control::TopologyRefresher; +use nym_topology_control::TopologyRefresherConfig; use rand::seq::SliceRandom; use rand::thread_rng; use std::net::SocketAddr; diff --git a/sdk/rust/nym-sdk/Cargo.toml b/sdk/rust/nym-sdk/Cargo.toml index c0a0960f79..5dbd239da4 100644 --- a/sdk/rust/nym-sdk/Cargo.toml +++ b/sdk/rust/nym-sdk/Cargo.toml @@ -20,6 +20,7 @@ nym-network-defaults = { path = "../../../common/network-defaults" } nym-sphinx = { path = "../../../common/nymsphinx" } nym-task = { path = "../../../common/task" } nym-topology = { path = "../../../common/topology" } +nym-topology-control = { path = "../../../common/topology-control" } nym-socks5-client-core = { path = "../../../common/socks5-client-core" } nym-validator-client = { path = "../../../common/client-libs/validator-client", features = ["http-client"] } nym-socks5-requests = { path = "../../../common/socks5/requests" } diff --git a/sdk/rust/nym-sdk/src/mixnet.rs b/sdk/rust/nym-sdk/src/mixnet.rs index 9dc4dd9681..dbd5281511 100644 --- a/sdk/rust/nym-sdk/src/mixnet.rs +++ b/sdk/rust/nym-sdk/src/mixnet.rs @@ -54,9 +54,8 @@ pub use nym_client_core::{ fs_backend::Backend as ReplyStorage, CombinedReplyStorage, Empty as EmptyReplyStorage, ReplyStorageBackend, }, - topology_control::geo_aware_provider::{CountryGroup, GeoAwareTopologyProvider}, }, - config::{GatewayEndpointConfig, GroupBy}, + config::GatewayEndpointConfig, }; pub use nym_credential_storage::{ ephemeral_storage::EphemeralStorage as EphemeralCredentialStorage, models::CoconutCredential, @@ -73,6 +72,9 @@ pub use nym_sphinx::{ receiver::ReconstructedMessage, }; pub use nym_topology::{provider_trait::TopologyProvider, NymTopology}; +pub use nym_topology_control::geo_aware_provider::{ + CountryGroup, GeoAwareTopologyProvider, GroupBy, +}; pub use paths::StoragePaths; pub use socks5_client::Socks5MixnetClient; pub use traits::MixnetMessageSender;