Skip to content

Commit

Permalink
chore: fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolay-komarevskiy committed Jul 16, 2024
1 parent 9b6dea6 commit e79769f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 20 deletions.
30 changes: 13 additions & 17 deletions ic-agent/src/agent/builder.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
use reqwest::Client;

use crate::{
agent::{
agent_config::AgentConfig,
http_transport::{
dynamic_routing::{
dynamic_route_provider::{DynamicRouteProviderBuilder, IC0_SEED_DOMAIN},
node::Node,
snapshot::latency_based_routing::LatencyRoutingSnapshot,
},
route_provider::RouteProvider,
},
Agent, Transport,
},
agent::{agent_config::AgentConfig, Agent, Transport},
AgentError, Identity, NonceFactory, NonceGenerator,
};
use std::sync::Arc;
Expand All @@ -29,9 +16,18 @@ impl AgentBuilder {
Agent::new(self.config)
}

/// Set the dynamic transport layer for the [`Agent`], performing continuos discovery of the API boundary nodes and routing traffic via them based on the latencies.
pub async fn with_discovery_transport(self, client: Client) -> Self {
use crate::agent::http_transport::ReqwestTransport;
#[cfg(all(feature = "reqwest", not(target_family = "wasm")))]
/// Set the dynamic transport layer for the [`Agent`], performing continuos discovery of the API boundary nodes and routing traffic via them based on the latencies.
pub async fn with_discovery_transport(self, client: reqwest::Client) -> Self {
use crate::agent::http_transport::{
dynamic_routing::{
dynamic_route_provider::{DynamicRouteProviderBuilder, IC0_SEED_DOMAIN},
node::Node,
snapshot::latency_based_routing::LatencyRoutingSnapshot,
},
route_provider::RouteProvider,
ReqwestTransport,
};

// TODO: This is a temporary solution to get the seed node.
let seed = Node::new(IC0_SEED_DOMAIN).unwrap();
Expand Down
4 changes: 1 addition & 3 deletions ic-agent/src/agent/http_transport/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@ const ICP0_SUB_DOMAIN: &str = ".icp0.io";
const ICP_API_SUB_DOMAIN: &str = ".icp-api.io";
#[allow(dead_code)]
const LOCALHOST_SUB_DOMAIN: &str = ".localhost";
///
#[cfg(not(target_family = "wasm"))]
#[cfg(feature = "reqwest")]
#[cfg(all(feature = "reqwest", not(target_family = "wasm")))]
pub mod dynamic_routing;
pub mod route_provider;

0 comments on commit e79769f

Please sign in to comment.