pub fn accept<S: Read + Write + PeerAddr>(
config: Arc<ServerConfig>,
io: S,
) -> Result<(StreamOwned<ServerConnection, S>, PeerIdentity), PeerError>Expand description
Accepts a peer over io, completing the handshake before returning.
A client whose certificate the configured Trust refuses fails the
handshake; when the trust is a store-backed pin set and the client proved it holds the
certificate’s key, it is recorded as waiting under the address of io.
It returns a verified client, so it needs one: with a server built with
ClientAuth::None it fails
with PeerError::Certificate after the handshake. Accept those with
TlsHandshake::finish_unauthenticated, or
with rustls’s or tokio-rustls’s own acceptor, which need nothing from this crate.
§Errors
PeerError::Io when the handshake fails; PeerError::refusal says why this side
refused the peer certificate, when it did.