Server Side internal DoT/DoH opt out (#5577)

This commit is contained in:
Jack Wampler
2025-03-12 10:14:04 -06:00
committed by GitHub
parent 960e817b8f
commit 79ce611d21
13 changed files with 128 additions and 29 deletions
+7
View File
@@ -1,6 +1,7 @@
// Copyright 2024 - Nym Technologies SA <contact@nymtech.net>
// SPDX-License-Identifier: GPL-3.0-only
use nym_http_api_client::HttpClientError;
use std::io;
use std::net::SocketAddr;
use thiserror::Error;
@@ -24,4 +25,10 @@ pub enum NymNodeHttpError {
#[from]
source: nym_crypto::asymmetric::encryption::KeyRecoveryError,
},
#[error("error building or using HTTP client: {source}")]
ClientError {
#[from]
source: HttpClientError,
},
}
+17 -3
View File
@@ -814,9 +814,23 @@ impl NymNode {
return;
}
for nym_api in &self.config.mixnet.nym_api_urls {
info!("trying {nym_api}...");
let client = NymApiClient::new_with_user_agent(nym_api.clone(), self.user_agent());
for nym_api_url in &self.config.mixnet.nym_api_urls {
info!("trying {nym_api_url}...");
let nym_api =
match nym_http_api_client::ClientBuilder::new_with_url(nym_api_url.clone())
.no_hickory_dns()
.with_user_agent(self.user_agent())
.build::<&str>()
{
Ok(b) => b,
Err(e) => {
warn!("failed to build http client for \"{nym_api_url}\": {e}",);
continue;
}
};
let client = NymApiClient { nym_api };
// make new request every time in case previous one takes longer and invalidates the signature
let request = NodeRefreshBody::new(self.ed25519_identity_keys.private_key());
+9 -2
View File
@@ -9,6 +9,7 @@ use nym_node_metrics::prometheus_wrapper::{PrometheusMetric, PROMETHEUS_METRICS}
use nym_task::ShutdownToken;
use nym_topology::node::RoutingNode;
use nym_topology::{EpochRewardedSet, NymTopology, Role, TopologyProvider};
use nym_validator_client::nym_api::NymApiClientExt;
use nym_validator_client::nym_nodes::{NodesByAddressesResponse, SkimmedNode};
use nym_validator_client::{NymApiClient, ValidatorClientError};
use std::collections::HashSet;
@@ -167,6 +168,7 @@ impl NodesQuerier {
) -> Result<NodesByAddressesResponse, ValidatorClientError> {
let res = self
.client
.nym_api
.nodes_by_addresses(ips)
.await
.inspect_err(|err| error!("failed to obtain node information: {err}"));
@@ -174,7 +176,7 @@ impl NodesQuerier {
if res.is_err() {
self.use_next_nym_api()
}
res
Ok(res?)
}
}
@@ -263,9 +265,14 @@ impl NetworkRefresher {
pending_check_interval: Duration,
shutdown_token: ShutdownToken,
) -> Result<Self, NymNodeError> {
let nym_api = nym_http_api_client::Client::builder(nym_api_urls[0].clone())?
.no_hickory_dns()
.with_user_agent(user_agent)
.build()?;
let mut this = NetworkRefresher {
querier: NodesQuerier {
client: NymApiClient::new_with_user_agent(nym_api_urls[0].clone(), user_agent),
client: NymApiClient { nym_api },
nym_api_urls,
currently_used_api: 0,
},