File tree Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Expand file tree Collapse file tree 1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -12,23 +12,17 @@ Asynchronous TLS/SSL streams for [Tokio](https://tokio.rs/) using
12
12
### Basic Structure of a Client
13
13
14
14
``` rust
15
+ use rustls_pki_types :: ServerName ;
15
16
use std :: sync :: Arc ;
16
17
use tokio :: net :: TcpStream ;
17
- use tokio_rustls :: rustls :: {ClientConfig , OwnedTrustAnchor , RootCertStore , ServerName };
18
+ use tokio_rustls :: rustls :: {ClientConfig , RootCertStore };
18
19
use tokio_rustls :: TlsConnector ;
19
20
20
21
// ...
21
22
22
23
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 ());
30
25
let config = ClientConfig :: builder ()
31
- . with_safe_defaults ()
32
26
. with_root_certificates (root_cert_store )
33
27
. with_no_client_auth ();
34
28
let connector = TlsConnector :: from (Arc :: new (config ));
You can’t perform that action at this time.
0 commit comments