Skip to content

Commit 5c2ea57

Browse files
committed
refactor: rename CaRootsConfig to CaTlsConfig
1 parent cf2fb5e commit 5c2ea57

25 files changed

Lines changed: 91 additions & 91 deletions

File tree

iroh-dns-server/benches/write.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use iroh::{
44
address_lookup::pkarr::PkarrRelayClient,
55
dns::DnsResolver,
66
endpoint_info::EndpointInfo,
7-
tls::{CaRootsConfig, default_provider},
7+
tls::{CaTlsConfig, default_provider},
88
};
99
use iroh_dns_server::{Server, config::Config};
1010
use rand::RngExt;
@@ -29,7 +29,7 @@ fn benchmark_dns_server(c: &mut Criterion) {
2929
let secret_key = SecretKey::from_bytes(&rng.random());
3030
let endpoint_id = secret_key.public();
3131

32-
let tls_config = CaRootsConfig::default()
32+
let tls_config = CaTlsConfig::default()
3333
.client_config(default_provider())
3434
.expect("infallible");
3535
let pkarr_relay = LOCALHOST_PKARR.parse().expect("valid url");

iroh-dns-server/examples/publish.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use iroh::{
1010
},
1111
dns::DnsResolver,
1212
endpoint_info::EndpointInfo,
13-
tls::{CaRootsConfig, default_provider},
13+
tls::{CaTlsConfig, default_provider},
1414
};
1515
use iroh_dns::IROH_TXT_NAME;
1616
use n0_error::{Result, StackResultExt};
@@ -105,7 +105,7 @@ async fn main() -> Result<()> {
105105
println!();
106106
println!("publish to {pkarr_relay_url} ...");
107107

108-
let tls_config = CaRootsConfig::default()
108+
let tls_config = CaTlsConfig::default()
109109
.client_config(default_provider())
110110
.expect("infallible");
111111
let pkarr = PkarrRelayClient::new(pkarr_relay_url, tls_config, DnsResolver::default());

iroh-dns-server/src/http.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ mod tests {
319319
RelayUrl, SecretKey,
320320
address_lookup::{EndpointInfo, PkarrRelayClient},
321321
dns::DnsResolver,
322-
tls::{CaRootsConfig, default_provider},
322+
tls::{CaTlsConfig, default_provider},
323323
};
324324
use n0_error::StdResultExt;
325325
use n0_tracing_test::traced_test;
@@ -357,7 +357,7 @@ mod tests {
357357
};
358358

359359
let http_url = server.http_url().expect("http is bound");
360-
let tls_config = CaRootsConfig::default()
360+
let tls_config = CaTlsConfig::default()
361361
.client_config(default_provider())
362362
.expect("infallible");
363363
let pkarr = PkarrRelayClient::new(

iroh-dns-server/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ mod tests {
4747
address_lookup::PkarrRelayClient,
4848
dns::DnsResolver,
4949
endpoint_info::EndpointInfo,
50-
tls::{CaRootsConfig, default_provider},
50+
tls::{CaTlsConfig, default_provider},
5151
};
5252
use iroh_dns::pkarr::SignedPacket;
5353
use mainline::{DhtBuilder, MutableItem, Testnet};
@@ -151,7 +151,7 @@ mod tests {
151151
let signed_packet = SignedPacket::from_bytes(&raw).anyerr()?;
152152

153153
// Publish via relay
154-
let tls_config = CaRootsConfig::default()
154+
let tls_config = CaTlsConfig::default()
155155
.client_config(default_provider())
156156
.expect("infallible");
157157
let pkarr_client =
@@ -220,7 +220,7 @@ mod tests {
220220

221221
let secret_key = SecretKey::from_bytes(&rng.random());
222222
let endpoint_id = secret_key.public();
223-
let tls_config = CaRootsConfig::default()
223+
let tls_config = CaTlsConfig::default()
224224
.client_config(default_provider())
225225
.expect("infallible");
226226
let pkarr = PkarrRelayClient::new(pkarr_relay, tls_config, DnsResolver::default());

iroh-relay/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ iroh = { version = "0.95", features = ["test-utils"] }
7474
```
7575
- Spawn a relay server by calling [`iroh::test_utils::run_relay_server().await`](https://docs.rs/iroh/latest/iroh/test_utils/fn.run_relay_server.html)
7676
This will start a relay server with a self-signed TLS certificate, listening on a localhost port, and return the server's URL.
77-
- For the iroh endpoints to successfully connect to the relay, disable TLS certificate verification by calling [`Endpoint::ca_roots_config`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.ca_roots_config) with `CaRootConfig::insecure_skip_verify()`.
77+
- For the iroh endpoints to successfully connect to the relay, disable TLS certificate verification by calling [`Endpoint::ca_tls_config`](https://docs.rs/iroh/latest/iroh/endpoint/struct.Builder.html#method.ca_tls_config) with `CaRootConfig::insecure_skip_verify()`.
7878

7979
# License
8080

iroh-relay/src/client.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -188,22 +188,22 @@ impl ClientBuilder {
188188
/// This is a required option.
189189
///
190190
/// You can construct a [`rustls::ClientConfig`] by combining a [`rustls::crypto::CryptoProvider`]
191-
/// with a [`tls::CaRootsConfig`] using [`tls::CaRootsConfig::client_config`], for example:
191+
/// with a [`tls::CaTlsConfig`] using [`tls::CaTlsConfig::client_config`], for example:
192192
///
193193
/// ```no_run
194194
/// use std::sync::Arc;
195195
///
196-
/// use iroh_relay::tls::CaRootsConfig;
196+
/// use iroh_relay::tls::CaTlsConfig;
197197
///
198198
/// let crypto_provider: rustls::crypto::CryptoProvider = todo!();
199-
/// let client_config = CaRootsConfig::default().client_config(Arc::new(crypto_provider));
199+
/// let client_config = CaTlsConfig::default().client_config(Arc::new(crypto_provider));
200200
/// ```
201201
///
202202
/// If you enable the tls-ring or tls-aws-lc-rs feature, you can use the enabled crypto provider
203203
/// by using [`tls::default_provider`].
204204
///
205-
/// [`tls::CaRootsConfig`]: crate::tls::CaRootsConfig
206-
/// [`tls::CaRootsConfig::client_config`]: crate::tls::CaRootsConfig::client_config
205+
/// [`tls::CaTlsConfig`]: crate::tls::CaTlsConfig
206+
/// [`tls::CaTlsConfig::client_config`]: crate::tls::CaTlsConfig::client_config
207207
/// [`tls::default_provider`]: crate::tls::default_provider
208208
pub fn tls_client_config(mut self, tls_config: rustls::ClientConfig) -> Self {
209209
self.tls_config = Some(tls_config);

iroh-relay/src/server.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ mod tests {
11771177
handshake,
11781178
relay::{ClientToRelayMsg, Datagrams, RelayToClientMsg},
11791179
},
1180-
tls::{CaRootsConfig, default_provider},
1180+
tls::{CaTlsConfig, default_provider},
11811181
};
11821182

11831183
/// An [`AccessControl`] backed by a closure, for tests.
@@ -1314,7 +1314,7 @@ mod tests {
13141314
let relay_url = format!("http://{}", server.http_addr().unwrap());
13151315
let relay_url: RelayUrl = relay_url.parse()?;
13161316

1317-
let client_config = CaRootsConfig::default()
1317+
let client_config = CaTlsConfig::default()
13181318
.client_config(default_provider())
13191319
.unwrap();
13201320

@@ -1379,7 +1379,7 @@ mod tests {
13791379
let current_span = tracing::info_span!("this is a test");
13801380
let _guard = current_span.enter();
13811381

1382-
let client_config = CaRootsConfig::default()
1382+
let client_config = CaTlsConfig::default()
13831383
.client_config(default_provider())
13841384
.unwrap();
13851385

@@ -1468,7 +1468,7 @@ mod tests {
14681468
const TOKEN: &str = "secret-token";
14691469

14701470
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64);
1471-
let client_config = CaRootsConfig::default()
1471+
let client_config = CaTlsConfig::default()
14721472
.client_config(default_provider())
14731473
.unwrap();
14741474

@@ -1535,7 +1535,7 @@ mod tests {
15351535
let relay_url = format!("http://{}", server.http_addr().unwrap());
15361536
let relay_url: RelayUrl = relay_url.parse().unwrap();
15371537

1538-
let client_config = CaRootsConfig::default()
1538+
let client_config = CaTlsConfig::default()
15391539
.client_config(default_provider())
15401540
.unwrap();
15411541

iroh-relay/src/server/http_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@ mod tests {
11971197
use crate::{
11981198
client::{Client, ClientBuilder, ConnectError, conn::Conn},
11991199
protos::relay::{ClientToRelayMsg, Datagrams, RelayToClientMsg},
1200-
tls::{CaRootsConfig, default_provider},
1200+
tls::{CaTlsConfig, default_provider},
12011201
};
12021202

12031203
pub(crate) fn make_tls_config() -> TlsConfig {
@@ -1303,7 +1303,7 @@ mod tests {
13031303
) -> Result<(PublicKey, Client), ConnectError> {
13041304
let public_key = key.public();
13051305
let client = ClientBuilder::new(server_url, key, DnsResolver::new()).tls_client_config(
1306-
CaRootsConfig::insecure_skip_verify()
1306+
CaTlsConfig::insecure_skip_verify()
13071307
.client_config(default_provider())
13081308
.expect("infallible"),
13091309
);

iroh-relay/src/tls.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use webpki_types::CertificateDer;
1919
/// CAs don't need to be trusted for the integrity or authenticity of native
2020
/// iroh connections, which rely on iroh's own cryptographic authentication mechanisms.
2121
#[derive(Debug, Clone)]
22-
pub struct CaRootsConfig {
22+
pub struct CaTlsConfig {
2323
mode: Mode,
2424
extra_roots: Vec<CertificateDer<'static>>,
2525
}
@@ -54,7 +54,7 @@ enum Mode {
5454
},
5555
}
5656

57-
impl Default for CaRootsConfig {
57+
impl Default for CaTlsConfig {
5858
fn default() -> Self {
5959
Self {
6060
mode: Mode::EmbeddedWebPki,
@@ -63,7 +63,7 @@ impl Default for CaRootsConfig {
6363
}
6464
}
6565

66-
impl CaRootsConfig {
66+
impl CaTlsConfig {
6767
/// Uses the operating system's certificate facilities for verifying the validity of TLS certificates.
6868
///
6969
/// See [`rustls_platform_verifier`] for details how trust anchors are retrieved on different platforms.
@@ -107,7 +107,7 @@ impl CaRootsConfig {
107107
}
108108
}
109109

110-
/// Creates a [`CaRootsConfig`] that uses a callback function to create a [`ServerCertVerifier`].
110+
/// Creates a [`CaTlsConfig`] that uses a callback function to create a [`ServerCertVerifier`].
111111
///
112112
/// This is an advanced feature and you should only use this if none of the other constructor
113113
/// functions cover your needs. Wrongly implementing the callback may lead to insecure connections
@@ -121,13 +121,13 @@ impl CaRootsConfig {
121121
///
122122
/// ```rust
123123
/// # use std::{io, sync::Arc};
124-
/// # use iroh_relay::tls::CaRootsConfig;
124+
/// # use iroh_relay::tls::CaTlsConfig;
125125
/// # use rustls::client::WebPkiServerVerifier;
126126
/// let root_store = Arc::new(rustls::RootCertStore {
127127
/// roots: webpki_roots::TLS_SERVER_ROOTS.to_vec(),
128128
/// });
129-
/// let ca_roots_config =
130-
/// CaRootsConfig::custom_server_cert_verifier(Arc::new(move |crypto_provider| {
129+
/// let ca_tls_config =
130+
/// CaTlsConfig::custom_server_cert_verifier(Arc::new(move |crypto_provider| {
131131
/// let mut root_store = rustls::RootCertStore {
132132
/// roots: webpki_roots::TLS_SERVER_ROOTS.to_vec(),
133133
/// };

iroh-relay/tests/relay_axum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use iroh_relay::{
3939
AllowAll, ClientRequest, DynAccessControl, Metrics, client::Config, clients::Clients,
4040
streams::RelayedStream,
4141
},
42-
tls::{CaRootsConfig, default_provider},
42+
tls::{CaTlsConfig, default_provider},
4343
};
4444
use n0_error::{AnyError, Result, StdResultExt};
4545
use n0_future::{Sink, Stream, task::AbortOnDropHandle};
@@ -217,7 +217,7 @@ async fn relay_embed_axum() -> Result<()> {
217217
// Connect a relay client to `/relay` on the same axum-fronted port.
218218
let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64);
219219
let relay_url: RelayUrl = format!("http://{addr}").parse()?;
220-
let tls_config = CaRootsConfig::default().client_config(default_provider())?;
220+
let tls_config = CaTlsConfig::default().client_config(default_provider())?;
221221
tokio::time::timeout(
222222
Duration::from_secs(5),
223223
ClientBuilder::new(

0 commit comments

Comments
 (0)