pub fn connect_pinned(
addr: impl ToSocketAddrs,
certs: impl AsRef<[Certificate]> + Send + Sync + 'static,
) -> Result<StreamOwned<ClientSession, TcpStream>, Error>
Expand description
Make a TCP connection to addr
and set up a TLS session.
The first time you try to write or read the returned stream,
rustls
will do TLS negotiation.
TLS negotiation fails if the server provides a leaf cert
that is not in certs
.
Ignores hostnames in certificates.
§Errors
Returns an error if it fails to open the TCP connection.
§Example
See example in rustls_pin
crate docs.