diff --git a/Cargo.lock b/Cargo.lock index 917fe3c6a0..04f9da4092 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6790,7 +6790,6 @@ dependencies = [ "nym-bandwidth-controller", "nym-credential-storage", "nym-credentials-interface", - "nym-http-api-client", "nym-ip-packet-client", "nym-registration-common", "nym-sdk", diff --git a/common/client-core/src/client/base_client/mod.rs b/common/client-core/src/client/base_client/mod.rs index 584288b78a..af065b3dec 100644 --- a/common/client-core/src/client/base_client/mod.rs +++ b/common/client-core/src/client/base_client/mod.rs @@ -218,7 +218,6 @@ pub struct BaseClientBuilder { shutdown: Option, event_tx: Option, user_agent: Option, - custom_nym_api_client: Option, setup_method: GatewaySetup, @@ -248,7 +247,6 @@ where shutdown: None, event_tx: None, user_agent: None, - custom_nym_api_client: None, setup_method: GatewaySetup::MustLoad { gateway_id: None }, #[cfg(unix)] connection_fd_callback: None, @@ -256,12 +254,6 @@ where } } - #[must_use] - pub fn with_nym_api_client(mut self, client: nym_http_api_client::Client) -> Self { - self.custom_nym_api_client = Some(client); - self - } - #[must_use] pub fn with_derivation_material( mut self, @@ -873,17 +865,7 @@ where fn construct_nym_api_client( config: &Config, user_agent: Option, - custom_client: Option, ) -> Result { - // If a custom client was provided (e.g., with domain fronting support), use it - if let Some(client) = custom_client { - tracing::debug!("Using custom nym-api HTTP client"); - return Ok(client); - } - - tracing::debug!("Creating default nym-api HTTP client from config"); - - // Otherwise, create a basic client let mut nym_api_urls = config.get_nym_api_endpoints(); nym_api_urls.shuffle(&mut thread_rng()); @@ -979,11 +961,7 @@ where .dkg_query_client .map(|client| BandwidthController::new(credential_store, client)); - let nym_api_client = Self::construct_nym_api_client( - &self.config, - self.user_agent.clone(), - self.custom_nym_api_client, - )?; + let nym_api_client = Self::construct_nym_api_client(&self.config, self.user_agent.clone())?; let key_rotation_config = Self::determine_key_rotation_state(&nym_api_client).await?; let topology_provider = Self::setup_topology_provider( diff --git a/nym-registration-client/Cargo.toml b/nym-registration-client/Cargo.toml index dbff96026c..e468af0998 100644 --- a/nym-registration-client/Cargo.toml +++ b/nym-registration-client/Cargo.toml @@ -23,7 +23,6 @@ nym-authenticator-client = { path = "../nym-authenticator-client" } nym-bandwidth-controller = { path = "../common/bandwidth-controller" } nym-credential-storage = { path = "../common/credential-storage" } nym-credentials-interface = { path = "../common/credentials-interface" } -nym-http-api-client = { path = "../common/http-api-client" } nym-ip-packet-client = { path = "../nym-ip-packet-client" } nym-registration-common = { path = "../common/registration" } nym-sdk = { path = "../sdk/rust/nym-sdk" } diff --git a/nym-registration-client/src/builder/config.rs b/nym-registration-client/src/builder/config.rs index b7070d1c5b..47f5f7c8e8 100644 --- a/nym-registration-client/src/builder/config.rs +++ b/nym-registration-client/src/builder/config.rs @@ -34,7 +34,6 @@ pub struct BuilderConfig { pub two_hops: bool, pub user_agent: UserAgent, pub custom_topology_provider: Box, - pub custom_nym_api_client: Option, pub network_env: NymNetworkDetails, pub cancel_token: CancellationToken, #[cfg(unix)] @@ -57,9 +56,6 @@ pub struct MixnetClientConfig { } impl BuilderConfig { - /// Create a new BuilderConfig without domain fronting support - /// - /// For domain fronting support, set `custom_nym_api_client` to Some(client) after creation #[allow(clippy::too_many_arguments)] pub fn new( entry_node: NymNodeWithKeys, @@ -81,7 +77,6 @@ impl BuilderConfig { two_hops, user_agent, custom_topology_provider, - custom_nym_api_client: None, network_env, cancel_token, #[cfg(unix)] @@ -89,12 +84,6 @@ impl BuilderConfig { } } - /// Set a custom nym-api HTTP client (for domain fronting support) - pub fn with_nym_api_client(mut self, client: nym_http_api_client::Client) -> Self { - self.custom_nym_api_client = Some(client); - self - } - pub fn mixnet_client_debug_config(&self) -> DebugConfig { if self.two_hops { two_hop_debug_config(&self.mixnet_client_config) @@ -147,7 +136,7 @@ impl BuilderConfig { RememberMe::new_mixnet() }; - let mut builder = builder + let builder = builder .with_user_agent(self.user_agent) .request_gateway(self.entry_node.node.identity.to_string()) .network_details(self.network_env) @@ -156,11 +145,6 @@ impl BuilderConfig { .with_remember_me(remember_me) .custom_topology_provider(self.custom_topology_provider); - if let Some(nym_api_client) = self.custom_nym_api_client { - tracing::debug!("Using custom nym-api HTTP client"); - builder = builder.with_nym_api_client(nym_api_client); - } - #[cfg(unix)] let builder = builder.with_connection_fd_callback(self.connection_fd_callback); @@ -263,23 +247,4 @@ mod tests { assert_eq!(config.min_mixnode_performance, None); assert_eq!(config.min_gateway_performance, None); } - - #[test] - fn test_builder_config_has_custom_client_field() { - // Verify that BuilderConfig has the custom_nym_api_client field - // by creating a simple HTTP client - let http_client = nym_http_api_client::Client::builder( - nym_http_api_client::Url::parse("https://validator.nymtech.net/api").unwrap(), - ) - .expect("Failed to create client builder") - .build() - .expect("Failed to build client"); - - // Verify the client works - let urls = http_client.base_urls(); - assert!( - !urls.is_empty() && urls[0].as_str().contains("validator.nymtech.net"), - "HTTP client should be configured with correct URL" - ); - } } diff --git a/sdk/rust/nym-sdk/src/mixnet/client.rs b/sdk/rust/nym-sdk/src/mixnet/client.rs index e333f4e656..3c5b122205 100644 --- a/sdk/rust/nym-sdk/src/mixnet/client.rs +++ b/sdk/rust/nym-sdk/src/mixnet/client.rs @@ -54,7 +54,6 @@ pub struct MixnetClientBuilder { custom_topology_provider: Option>, custom_gateway_transceiver: Option>, custom_shutdown: Option, - custom_nym_api_client: Option, event_tx: Option, force_tls: bool, user_agent: Option, @@ -94,7 +93,6 @@ impl MixnetClientBuilder { socks5_config: None, wait_for_gateway: false, custom_topology_provider: None, - custom_nym_api_client: None, storage: storage_paths .initialise_default_persistent_storage() .await?, @@ -133,7 +131,6 @@ where wait_for_gateway: false, custom_topology_provider: None, custom_gateway_transceiver: None, - custom_nym_api_client: None, custom_shutdown: None, event_tx: None, force_tls: false, @@ -158,7 +155,6 @@ where wait_for_gateway: self.wait_for_gateway, custom_topology_provider: self.custom_topology_provider, custom_gateway_transceiver: self.custom_gateway_transceiver, - custom_nym_api_client: self.custom_nym_api_client, custom_shutdown: self.custom_shutdown, event_tx: self.event_tx, force_tls: self.force_tls, @@ -298,12 +294,6 @@ where self } - #[must_use] - pub fn with_nym_api_client(mut self, client: nym_http_api_client::Client) -> Self { - self.custom_nym_api_client = Some(client); - self - } - #[must_use] pub fn with_statistics_reporting(mut self, config: StatsReporting) -> Self { self.config.debug_config.stats_reporting = config; @@ -348,7 +338,6 @@ where client.custom_gateway_transceiver = self.custom_gateway_transceiver; client.custom_topology_provider = self.custom_topology_provider; - client.custom_nym_api_client = self.custom_nym_api_client; client.custom_shutdown = self.custom_shutdown; client.wait_for_gateway = self.wait_for_gateway; client.force_tls = self.force_tls; @@ -398,9 +387,6 @@ where /// advanced usage of custom gateways custom_gateway_transceiver: Option>, - /// Custom nym-api HTTP client (for domain fronting support) - custom_nym_api_client: Option, - /// Attempt to wait for the selected gateway (if applicable) to come online if its currently not bonded. wait_for_gateway: bool, @@ -473,7 +459,6 @@ where storage, custom_topology_provider: None, custom_gateway_transceiver: None, - custom_nym_api_client: None, wait_for_gateway: false, force_tls: false, custom_shutdown: None, @@ -731,11 +716,6 @@ where base_builder = base_builder.with_user_agent(user_agent); } - if let Some(nym_api_client) = self.custom_nym_api_client { - tracing::debug!("Using custom nym-api HTTP client"); - base_builder = base_builder.with_nym_api_client(nym_api_client); - } - if let Some(topology_provider) = self.custom_topology_provider { base_builder = base_builder.with_topology_provider(topology_provider); }