Skip to content

Commit 0184703

Browse files
jwodderdjc
authored andcommitted
Update example code in README for v0.25.0
1 parent 5343443 commit 0184703

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,17 @@ Asynchronous TLS/SSL streams for [Tokio](https://tokio.rs/) using
1212
### Basic Structure of a Client
1313

1414
```rust
15+
use rustls_pki_types::ServerName;
1516
use std::sync::Arc;
1617
use tokio::net::TcpStream;
17-
use tokio_rustls::rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore, ServerName};
18+
use tokio_rustls::rustls::{ClientConfig, RootCertStore};
1819
use tokio_rustls::TlsConnector;
1920

2021
// ...
2122

2223
let mut root_cert_store = RootCertStore::empty();
23-
root_cert_store.add_trust_anchors(webpki_roots::TLS_SERVER_ROOTS.0.iter().map(|ta| {
24-
OwnedTrustAnchor::from_subject_spki_name_constraints(
25-
ta.subject,
26-
ta.spki,
27-
ta.name_constraints,
28-
)
29-
}));
24+
root_cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.iter().cloned());
3025
let config = ClientConfig::builder()
31-
.with_safe_defaults()
3226
.with_root_certificates(root_cert_store)
3327
.with_no_client_auth();
3428
let connector = TlsConnector::from(Arc::new(config));

0 commit comments

Comments
 (0)