Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: unstable dynamic routing feature #599

Merged
merged 11 commits into from
Sep 23, 2024
Merged
134 changes: 132 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 17 additions & 1 deletion ic-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ keywords = ["internet-computer", "agent", "icp", "dfinity"]
include = ["src", "Cargo.toml", "../LICENSE", "README.md"]

[dependencies]
arc-swap = { version = "1.7", optional = true }
async-channel = { version = "1.9", optional = true }
async-lock = "3.3"
async-trait = { version = "0.1", optional = true }
async-watch = { version = "0.3", optional = true }
backoff = "0.4.0"
cached = { version = "0.52", features = ["ahash"], default-features = false }
candid = { workspace = true }
Expand All @@ -41,8 +45,10 @@ serde_cbor = { workspace = true }
serde_repr = { workspace = true }
sha2 = { workspace = true }
simple_asn1 = "0.6.1"
stop-token = { version = "0.7", optional = true }
thiserror = { workspace = true }
time = { workspace = true }
tracing = { version = "0.1", optional = true }
url = "2.1.0"

[dependencies.reqwest]
Expand All @@ -67,6 +73,7 @@ web-sys = { version = "0.3", features = ["Window"], optional = true }

[dev-dependencies]
serde_json.workspace = true
tracing-subscriber = "0.3"

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
tokio = { workspace = true, features = ["full"] }
Expand Down Expand Up @@ -99,8 +106,17 @@ wasm-bindgen = [
"backoff/wasm-bindgen",
"cached/wasm",
]
_internal_dynamic-routing = [
"dep:arc-swap",
"dep:async-channel",
"dep:async-trait",
"dep:async-watch",
"dep:stop-token",
"tracing",
]
tracing = ["dep:tracing"] # Does very little right now.

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu", "wasm32-unknown-unknown"]
rustdoc-args = ["--cfg=docsrs"]
features = ["hyper"]
features = ["_internal_dynamic-routing"]
3 changes: 3 additions & 0 deletions ic-agent/src/agent/route_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use url::Url;

use crate::agent::AgentError;

#[cfg(feature = "_internal_dynamic-routing")]
pub mod dynamic_routing;

const IC0_DOMAIN: &str = "ic0.app";
const ICP0_DOMAIN: &str = "icp0.io";
const ICP_API_DOMAIN: &str = "icp-api.io";
Expand Down
Loading