Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Cargo.lock

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

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ http = "1.3.1"
http-body = "1.0.1"
http-body-util = "0.1.2"
humantime = "2.2.0"
ic-bn-lib = { version = "0.2.2", features = [
ic-bn-lib = { version = "0.2.4", features = [
"acme",
"vector",
"cert-providers",
"clients-hyper",
] }
ic-bn-lib-common = "0.2.2"
ic-custom-domains-backend = "0.2.4"
ic-custom-domains-base = "0.2.4"
ic-bn-lib-common = "0.2.4"
ic-custom-domains-backend = "0.2.6"
ic-custom-domains-base = "0.2.6"
ic-http-certification = { version = "3.1.0", optional = true }
ic-transport-types = "0.47"
ic-http-gateway-protocol = { package = "ic-http-gateway-protocol", git = "https://github.com/dfinity/ic-http-gateway-protocol", tag = "v0.5.1" }
Expand Down
6 changes: 1 addition & 5 deletions benches/domain_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,7 @@ fn criterion_benchmark(c: &mut Criterion) {
let custom_domains = domains
.clone()
.into_iter()
.map(|x| CustomDomain {
name: x,
canister_id: principal!("aaaaa-aa"),
timestamp: 0,
})
.map(|x| CustomDomain::new(x, principal!("aaaaa-aa")))
.collect::<Vec<_>>();

let s = CustomDomainStorage::new(
Expand Down
11 changes: 7 additions & 4 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ use reqwest::Url;

use crate::{
core::{AUTHOR_NAME, SERVICE_NAME},
routing::{RequestType, domain::CanisterAlias},
routing::{
RequestType,
domain::{CanisterAlias, CustomDomainHttpProvider},
},
};

/// Clap does not support prefixes due to macro limitations.
Expand Down Expand Up @@ -295,19 +298,19 @@ pub struct Domain {
/// List of generic custom domain provider URLs.
/// Expects a JSON object in form '{"domain.bar": "aaaaa-aa"}' in response to a GET request.
#[clap(env, long, value_delimiter = ',')]
pub domain_custom_provider: Vec<Url>,
pub domain_custom_provider: Vec<CustomDomainHttpProvider>,

/// List of generic timestamped custom domain provider URLs.
/// Expects a JSON object in form '{"timestamp": 1234, "url": "https://foo/bar"}' in response to a GET request.
/// When the timestamp changes - the provider gets the list of domains from the URL provided in response.
/// The JSON format there should be the same as for the normal generic provider (see above).
#[clap(env, long, value_delimiter = ',')]
pub domain_custom_provider_timestamped: Vec<Url>,
pub domain_custom_provider_timestamped: Vec<CustomDomainHttpProvider>,

/// List of generic differential custom domain provider URLs.
/// It first downloads the full seed and then only applies incremental updates to it using a timestamp.
#[clap(env, long, value_delimiter = ',')]
pub domain_custom_provider_diff: Vec<Url>,
pub domain_custom_provider_diff: Vec<CustomDomainHttpProvider>,

/// How frequently to poll custom domain providers for updates
#[clap(env, long, default_value = "30s", value_parser = parse_duration)]
Expand Down
22 changes: 15 additions & 7 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ pub async fn main(

Arc::new(custom_domains::GenericProvider::new(
http_client.clone(),
x.clone(),
x.url.clone(),
cli.domain.domain_custom_provider_timeout,
x.priority,
x.flags,
)) as Arc<dyn ProvidesCustomDomains>
}));

Expand All @@ -240,8 +242,10 @@ pub async fn main(

Arc::new(custom_domains::GenericProviderTimestamped::new(
http_client.clone(),
x.clone(),
x.url.clone(),
cli.domain.domain_custom_provider_timeout,
x.priority,
x.flags,
)) as Arc<dyn ProvidesCustomDomains>
}),
);
Expand All @@ -251,19 +255,23 @@ pub async fn main(

Arc::new(custom_domains::GenericProviderDiff::new(
http_client.clone(),
x.clone(),
x.url.clone(),
cli.domain.domain_custom_provider_timeout,
x.priority,
x.flags,
Duration::from_mins(5),
)) as Arc<dyn ProvidesCustomDomains>
}));

// Load local file custom domain provider
if let Some(path) = &cli.domain.domain_custom_provider_local_file {
warn!("Adding local file custom domain provider: {path}");

custom_domain_providers.push(
Arc::new(custom_domains::LocalFileProvider::new(path.into()))
as Arc<dyn ProvidesCustomDomains>,
);
custom_domain_providers.push(Arc::new(custom_domains::LocalFileProvider::new(
path.into(),
0,
None,
)) as Arc<dyn ProvidesCustomDomains>);
}

// Create IC Agent for use by RoutingTableManager / SMTP
Expand Down
Loading
Loading