pub struct SslStreamBuilder<S> { /* private fields */ }Expand description
A partially constructed SslStream, useful for unusual handshakes.
Implementationsยง
Sourceยงimpl<S> SslStreamBuilder<S>
impl<S> SslStreamBuilder<S>
Sourcepub fn new(ssl: Ssl, stream: S) -> SslStreamBuilder<S>
pub fn new(ssl: Ssl, stream: S) -> SslStreamBuilder<S>
Begin creating an SslStream atop stream
Sourcepub fn stateless(&mut self) -> Result<bool, ErrorStack>
pub fn stateless(&mut self) -> Result<bool, ErrorStack>
Perform a stateless server-side handshake
Requires that cookie generation and verification callbacks were set on the SSL context.
Returns Ok(true) if a complete ClientHello containing a valid cookie
was read, in which case the handshake should be continued via
accept. If a HelloRetryRequest containing a fresh cookie was
transmitted, Ok(false) is returned instead. If the handshake cannot
proceed at all, Err is returned.
This corresponds to SSL_stateless.
Sourcepub fn set_connect_state(&mut self)
pub fn set_connect_state(&mut self)
Configure as an outgoing stream from a client.
This corresponds to SSL_set_connect_state.
Sourcepub fn set_accept_state(&mut self)
pub fn set_accept_state(&mut self)
Configure as an incoming stream to a server.
This corresponds to SSL_set_accept_state.
Sourcepub fn connect(self) -> Result<SslStream<S>, HandshakeError<S>>
pub fn connect(self) -> Result<SslStream<S>, HandshakeError<S>>
See Ssl::connect
Sourcepub fn accept(self) -> Result<SslStream<S>, HandshakeError<S>>
pub fn accept(self) -> Result<SslStream<S>, HandshakeError<S>>
See Ssl::accept
Sourcepub fn handshake(self) -> Result<SslStream<S>, HandshakeError<S>>
pub fn handshake(self) -> Result<SslStream<S>, HandshakeError<S>>
Initiates the handshake.
This will fail if set_accept_state or set_connect_state was not called first.
This corresponds to SSL_do_handshake.
Sourcepub fn read_early_data(&mut self, buf: &mut [u8]) -> Result<usize, Error>
pub fn read_early_data(&mut self, buf: &mut [u8]) -> Result<usize, Error>
Read application data transmitted by a client before handshake completion.
Useful for reducing latency, but vulnerable to replay attacks. Call
set_accept_state first.
Returns Ok(0) if all early data has been read.
Requires OpenSSL 1.1.1 or LibreSSL 3.4.0 or newer.
This corresponds to SSL_read_early_data.
Sourcepub fn write_early_data(&mut self, buf: &[u8]) -> Result<usize, Error>
pub fn write_early_data(&mut self, buf: &[u8]) -> Result<usize, Error>
Send data to the server without blocking on handshake completion.
Useful for reducing latency, but vulnerable to replay attacks. Call
set_connect_state first.
Requires OpenSSL 1.1.1 or LibreSSL 3.4.0 or newer.
This corresponds to SSL_write_early_data.
Sourceยงimpl<S> SslStreamBuilder<S>
impl<S> SslStreamBuilder<S>
Sourcepub fn get_mut(&mut self) -> &mut S
pub fn get_mut(&mut self) -> &mut S
Returns a mutable reference to the underlying stream.
ยงWarning
It is inadvisable to read from or write to the underlying stream as it will most likely corrupt the SSL session.
Sourcepub fn ssl(&self) -> &SslRef
pub fn ssl(&self) -> &SslRef
Returns a shared reference to the Ssl object associated with this builder.
Sourcepub fn set_dtls_mtu_size(&mut self, mtu_size: usize)
๐Deprecated since 0.10.30: Use SslRef::set_mtu instead
pub fn set_dtls_mtu_size(&mut self, mtu_size: usize)
Set the DTLS MTU size.
It will be ignored if the value is smaller than the minimum packet size the DTLS protocol requires.
ยงPanics
This function panics if the given mtu size canโt be represented in a positive c_long range
Auto Trait Implementationsยง
impl<S> Freeze for SslStreamBuilder<S>
impl<S> RefUnwindSafe for SslStreamBuilder<S>where
S: RefUnwindSafe,
impl<S> Send for SslStreamBuilder<S>where
S: Send,
impl<S> Sync for SslStreamBuilder<S>where
S: Sync,
impl<S> Unpin for SslStreamBuilder<S>where
S: Unpin,
impl<S> UnwindSafe for SslStreamBuilder<S>where
S: UnwindSafe,
Blanket Implementationsยง
Sourceยงimpl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Sourceยงtype ArchivedMetadata = ()
type ArchivedMetadata = ()
Sourceยงfn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Sourceยงimpl<T> Instrument for T
impl<T> Instrument for T
Sourceยงfn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Sourceยงfn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Sourceยงimpl<T> IntoEither for T
impl<T> IntoEither for T
Sourceยงfn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงfn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSourceยงimpl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Sourceยงfn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Sourceยงimpl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Sourceยงunsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Sourceยงfn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.