Struct rustls::client::ClientConnection[][src]

pub struct ClientConnection { /* fields omitted */ }
Expand description

This represents a single TLS client connection.

Implementations

Make a new ClientConnection. config controls how we behave in the TLS protocol, name is the name of the server we want to talk to.

Returns an io::Write implementer you can write bytes to to send TLS1.3 early data (a.k.a. “0-RTT data”) to the server.

This returns None in many circumstances when the capability to send early data is not available, including but not limited to:

  • The server hasn’t been talked to previously.
  • The server does not support resumption.
  • The server does not support early data.
  • The resumption data for the server has expired.

The server specifies a maximum amount of early data. You can learn this limit through the returned object, and writes through it will process only this many bytes.

The server can choose not to accept any sent early data – in this case the data is lost but the connection continues. You can tell this happened using is_early_data_accepted.

Returns True if the server signalled it will process early data.

If you sent early data and this returns false at the end of the handshake then the server will not process the data. This is not an error, but you may wish to resend the data.

Methods from Deref<Target = ConnectionCommon<ClientConnectionData>>

Returns an object that allows reading plaintext.

Returns an object that allows writing plaintext.

This function uses io to complete any outstanding IO for this connection.

This is a convenience function which solely uses other parts of the public API.

What this means depends on the connection state:

The return value is the number of bytes read from and written to io, respectively.

This function will block if io blocks.

Errors from TLS record handling (i.e., from process_new_packets) are wrapped in an io::ErrorKind::InvalidData-kind error.

Processes any new packets read by a previous call to Connection::read_tls.

Errors from this function relate to TLS protocol errors, and are fatal to the connection. Future calls after an error will do no new work and will return the same error. After an error is received from process_new_packets, you should not call read_tls any more (it will fill up buffers to no purpose). However, you may call the other methods on the connection, including write, send_close_notify, and write_tls. Most likely you will want to call write_tls to send any alerts queued by the error and then close the underlying connection.

Success from this function comes with some sundry state data about the connection.

Read TLS content from rd. This method does internal buffering, so rd can supply TLS messages in arbitrary- sized chunks (like a socket or pipe might).

You should call process_new_packets each time a call to this function succeeds.

The returned error only relates to IO on rd. TLS-level errors are emitted from process_new_packets.

This function returns Ok(0) when the underlying rd does so. This typically happens when a socket is cleanly closed, or a file is at EOF.

Derives key material from the agreed connection secrets.

This function fills in output with output.len() bytes of key material derived from the master session secret using label and context for diversification.

See RFC5705 for more details on what this does and is for.

For TLS1.3 connections, this function does not use the “early” exporter at any point.

This function fails if called prior to the handshake completing; check with CommonState::is_handshaking first.

Trait Implementations

Make a new QUIC ClientConnection. This differs from ClientConnection::new() in that it takes an extra argument, params, which contains the TLS-encoded transport parameters to send. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Performs the conversion.

This is supported on crate feature quic only.

Return the TLS-encoded transport parameters for the session’s peer. Read more

This is supported on crate feature quic only.

Compute the keys for encrypting/decrypting 0-RTT packets, if available

This is supported on crate feature quic only.

Consume unencrypted TLS handshake data. Read more

This is supported on crate feature quic only.

Emit unencrypted TLS handshake data. Read more

This is supported on crate feature quic only.

Emit the TLS description code of a fatal alert, if one has arisen. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.