pub struct TlsHandshake { /* private fields */ }Expand description
One TLS handshake, driven by the caller: rustls’s own sans-IO connection.
A server records a refused, key-proven client as waiting under the source it was given,
exactly as accept does. After finish the
session is the finished [rustls::Connection], which keeps any
application data that arrived with the last handshake bytes.
Implementations§
Source§impl TlsHandshake
impl TlsHandshake
Sourcepub fn client(config: Arc<ClientConfig>) -> Result<Self, PeerError>
pub fn client(config: Arc<ClientConfig>) -> Result<Self, PeerError>
A handshake as the dialing side, sending SERVER_NAME as the
server name.
§Errors
PeerError::Tls when the connection cannot be created.
Sourcepub fn client_named(
config: Arc<ClientConfig>,
name: ServerName<'static>,
) -> Result<Self, PeerError>
pub fn client_named( config: Arc<ClientConfig>, name: ServerName<'static>, ) -> Result<Self, PeerError>
A handshake as the dialing side, sending name as the server name: the host dialled,
for a server verified by Roots. [Established::peer] is the
server’s leaf certificate’s fingerprint, however it was verified.
§Errors
PeerError::Tls when the connection cannot be created.
Sourcepub fn server(
config: Arc<ServerConfig>,
source: Option<SocketAddr>,
) -> Result<Self, PeerError>
pub fn server( config: Arc<ServerConfig>, source: Option<SocketAddr>, ) -> Result<Self, PeerError>
A handshake as the accepting side; source is where the peer connected from.
§Errors
PeerError::Tls when the connection cannot be created.
Sourcepub fn local(self, local: SocketAddr) -> Self
pub fn local(self, local: SocketAddr) -> Self
This handshake knowing the local address the connection arrived at, which a policy’s
access control list reads for rules that name a destination or a port. A server
handshake without one refuses a connection such a rule would decide
(Refusal::AddressUnknown).
Sourcepub fn finish_unauthenticated(
self,
) -> Result<(Connection, Option<PeerIdentity>), PeerError>
pub fn finish_unauthenticated( self, ) -> Result<(Connection, Option<PeerIdentity>), PeerError>
Finishes a completed handshake whose peer may have presented no certificate: the connection, and the peer’s verified certificate when it sent one.
A server built with ClientAuth::None
asks for none, so its peer is always None and [Handshake::finish], which needs a
peer, fails there. None means the client is not authenticated: the application
must authenticate it inside the connection before trusting it. Drive the handshake with
coqui_peer::complete_stream or complete_messages, then call this.
§Errors
PeerError::Tls when the handshake is not complete.
Trait Implementations§
Source§impl Debug for TlsHandshake
impl Debug for TlsHandshake
Source§impl Handshake for TlsHandshake
impl Handshake for TlsHandshake
Source§fn receive(&mut self, input: &[u8]) -> Result<(), PeerError>
fn receive(&mut self, input: &[u8]) -> Result<(), PeerError>
Framing]). Read moreSource§fn transmit(&mut self) -> Result<Option<Vec<u8>>, PeerError>
fn transmit(&mut self) -> Result<Option<Vec<u8>>, PeerError>
None when there is nothing to send until more
input arrives. Call until None. Read more