pub struct UnbufferedClientConnection { /* private fields */ }
Expand description
Unbuffered version of ClientConnection
See the crate::unbuffered
module docs for more details
Implementations§
Source§impl UnbufferedClientConnection
impl UnbufferedClientConnection
Sourcepub fn new(
config: Arc<ClientConfig>,
name: ServerName<'static>,
) -> Result<Self, Error>
pub fn new( config: Arc<ClientConfig>, name: ServerName<'static>, ) -> Result<Self, Error>
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.
Methods from Deref<Target = UnbufferedConnectionCommon<ClientConnectionData>>§
Sourcepub fn process_tls_records<'c, 'i>(
&'c mut self,
incoming_tls: &'i mut [u8],
) -> UnbufferedStatus<'c, 'i, ClientConnectionData>
pub fn process_tls_records<'c, 'i>( &'c mut self, incoming_tls: &'i mut [u8], ) -> UnbufferedStatus<'c, 'i, ClientConnectionData>
Processes the TLS records in incoming_tls
buffer until a new UnbufferedStatus
is
reached.
Sourcepub fn process_tls_records<'c, 'i>(
&'c mut self,
incoming_tls: &'i mut [u8],
) -> UnbufferedStatus<'c, 'i, ServerConnectionData>
pub fn process_tls_records<'c, 'i>( &'c mut self, incoming_tls: &'i mut [u8], ) -> UnbufferedStatus<'c, 'i, ServerConnectionData>
Processes the TLS records in incoming_tls
buffer until a new UnbufferedStatus
is
reached.
Methods from Deref<Target = CommonState>§
Sourcepub fn wants_write(&self) -> bool
pub fn wants_write(&self) -> bool
Returns true if the caller should call Connection::write_tls
as soon as possible.
Sourcepub fn is_handshaking(&self) -> bool
pub fn is_handshaking(&self) -> bool
Returns true if the connection is currently performing the TLS handshake.
During this time plaintext written to the connection is buffered in memory. After
Connection::process_new_packets()
has been called, this might start to return false
while the final handshake packets still need to be extracted from the connection’s buffers.
Sourcepub fn peer_certificates(&self) -> Option<&[CertificateDer<'static>]>
pub fn peer_certificates(&self) -> Option<&[CertificateDer<'static>]>
Retrieves the certificate chain or the raw public key used by the peer to authenticate.
The order of the certificate chain is as it appears in the TLS protocol: the first certificate relates to the peer, the second certifies the first, the third certifies the second, and so on.
When using raw public keys, the first and only element is the raw public key.
This is made available for both full and resumed handshakes.
For clients, this is the certificate chain or the raw public key of the server.
For servers, this is the certificate chain or the raw public key of the client, if client authentication was completed.
The return value is None until this value is available.
Note: the return type of the ‘certificate’, when using raw public keys is CertificateDer<'static>
even though this should technically be a SubjectPublicKeyInfoDer<'static>
.
This choice simplifies the API and ensures backwards compatibility.
Sourcepub fn alpn_protocol(&self) -> Option<&[u8]>
pub fn alpn_protocol(&self) -> Option<&[u8]>
Retrieves the protocol agreed with the peer via ALPN.
A return value of None
after handshake completion
means no protocol was agreed (because no protocols
were offered or accepted by the peer).
Sourcepub fn negotiated_cipher_suite(&self) -> Option<SupportedCipherSuite>
pub fn negotiated_cipher_suite(&self) -> Option<SupportedCipherSuite>
Retrieves the ciphersuite agreed with the peer.
This returns None until the ciphersuite is agreed.
Sourcepub fn negotiated_key_exchange_group(
&self,
) -> Option<&'static dyn SupportedKxGroup>
pub fn negotiated_key_exchange_group( &self, ) -> Option<&'static dyn SupportedKxGroup>
Retrieves the key exchange group agreed with the peer.
This function may return None
depending on the state of the connection,
the type of handshake, and the protocol version.
If CommonState::is_handshaking()
is true this function will return None
.
Similarly, if the CommonState::handshake_kind()
is HandshakeKind::Resumed
and the CommonState::protocol_version()
is TLS 1.2, then no key exchange will have
occurred and this function will return None
.
Sourcepub fn protocol_version(&self) -> Option<ProtocolVersion>
pub fn protocol_version(&self) -> Option<ProtocolVersion>
Retrieves the protocol version agreed with the peer.
This returns None
until the version is agreed.
Sourcepub fn handshake_kind(&self) -> Option<HandshakeKind>
pub fn handshake_kind(&self) -> Option<HandshakeKind>
Which kind of handshake was performed.
This tells you whether the handshake was a resumption or not.
This will return None
before it is known which sort of
handshake occurred.
Sourcepub fn wants_read(&self) -> bool
pub fn wants_read(&self) -> bool
Returns true if the caller should call Connection::read_tls
as soon
as possible.
If there is pending plaintext data to read with Connection::reader
,
this returns false. If your application respects this mechanism,
only one full TLS message will be buffered by rustls.
Trait Implementations§
Source§impl Deref for UnbufferedClientConnection
impl Deref for UnbufferedClientConnection
Source§type Target = UnbufferedConnectionCommon<ClientConnectionData>
type Target = UnbufferedConnectionCommon<ClientConnectionData>
Auto Trait Implementations§
impl Freeze for UnbufferedClientConnection
impl !RefUnwindSafe for UnbufferedClientConnection
impl Send for UnbufferedClientConnection
impl Sync for UnbufferedClientConnection
impl Unpin for UnbufferedClientConnection
impl !UnwindSafe for UnbufferedClientConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 936 bytes