pub struct SslStream<S> { /* private fields */ }Expand description
Compio asynchronous version of openssl:ssl::SslStream.
Implementations§
Source§impl<S: AsyncRead + AsyncWrite> SslStream<S>
impl<S: AsyncRead + AsyncWrite> SslStream<S>
Sourcepub fn new(ssl: Ssl, stream: S) -> Result<SslStream<S>, ErrorStack>
pub fn new(ssl: Ssl, stream: S) -> Result<SslStream<S>, ErrorStack>
Create a new SslStream.
Reference: SslStream::new
Sourcepub fn get_mut(&mut self) -> &mut S
pub fn get_mut(&mut self) -> &mut S
Get a mutable reference to the underlying stream.
§Warning
Any read/write operation to the stream would 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 stream.
Sourcepub async fn accept(&mut self) -> Result<()>
pub async fn accept(&mut self) -> Result<()>
Initiates a server-side TLS handshake.
Reference: SslStream::accept
Sourcepub async fn connect(&mut self) -> Result<()>
pub async fn connect(&mut self) -> Result<()>
Initiates a server-side TLS handshake.
Reference: SslStream::connect
Sourcepub async fn read_realy_data(&mut self, buf: &mut [u8]) -> Result<usize>
pub async fn read_realy_data(&mut self, buf: &mut [u8]) -> Result<usize>
Read application data transmitted by a client before handshake completion.
Useful for reducing latency, but vulnerable to replay attacks.
Returns Ok(0) if all early data has been read.
Reference: SslStream::read_early_data
Sourcepub async fn write_realy_data(&mut self, buf: &[u8]) -> Result<usize>
pub async fn write_realy_data(&mut self, buf: &[u8]) -> Result<usize>
Send data to the server without blocking on handshake completion.
Useful for reducing latency, but vulnerable to replay attacks.
Reference: SslStream::write_early_data
Sourcepub async fn peek(&mut self, buf: &mut [u8]) -> Result<usize>
pub async fn peek(&mut self, buf: &mut [u8]) -> Result<usize>
Reads data from the stream, without removing it from the queue.
Reference: SslStream::ssl_peek
Sourcepub fn get_shutdown(&mut self) -> ShutdownState
pub fn get_shutdown(&mut self) -> ShutdownState
Returns the session’s shutdown state.
Sourcepub fn set_shutdown(&mut self, state: ShutdownState)
pub fn set_shutdown(&mut self, state: ShutdownState)
Sets the session’s shutdown state.
This can be used to tell OpenSSL that the session should be cached even if a full two-way shutdown was not completed.
Sourcepub async fn stateless(&mut self) -> Result<bool, ErrorStack>
pub async 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.
Trait Implementations§
Source§impl<S: AsyncRead> AsyncRead for SslStream<S>
impl<S: AsyncRead> AsyncRead for SslStream<S>
Source§impl<S: AsyncWrite + AsyncRead> AsyncWrite for SslStream<S>
AsyncRead is needed for shutting down stream.
impl<S: AsyncWrite + AsyncRead> AsyncWrite for SslStream<S>
AsyncRead is needed for shutting down stream.
Source§async fn flush(&mut self) -> Result<()>
async fn flush(&mut self) -> Result<()>
Source§async fn shutdown(&mut self) -> Result<()>
async fn shutdown(&mut self) -> Result<()>
Source§async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>where
T: IoVectoredBuf,
async fn write_vectored<T>(&mut self, buf: T) -> BufResult<usize, T>where
T: IoVectoredBuf,
write, except that it write bytes from a buffer implements
IoVectoredBuf into the source. Read moreAuto Trait Implementations§
impl<S> Freeze for SslStream<S>
impl<S> RefUnwindSafe for SslStream<S>where
S: RefUnwindSafe,
impl<S> Send for SslStream<S>where
S: Send,
impl<S> Sync for SslStream<S>where
S: Sync,
impl<S> Unpin for SslStream<S>where
S: Unpin,
impl<S> UnwindSafe for SslStream<S>where
S: UnwindSafe,
Blanket Implementations§
Source§impl<A> AsyncReadExt for A
impl<A> AsyncReadExt for A
Source§async fn read_exact<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoBufMut,
async fn read_exact<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoBufMut,
Source§async fn read_to_end(&mut self, buf: Vec<u8>) -> BufResult<usize, Vec<u8>>
async fn read_to_end(&mut self, buf: Vec<u8>) -> BufResult<usize, Vec<u8>>
EOF.Source§async fn read_vectored_exact<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoVectoredBufMut,
async fn read_vectored_exact<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoVectoredBufMut,
Source§fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
fn take(self, limit: u64) -> Take<Self>where
Self: Sized,
limit bytes from it. Read moreSource§async fn read_u8(&mut self) -> Result<u8, Error>
async fn read_u8(&mut self) -> Result<u8, Error>
u8 from the underlying reader.Source§async fn read_u8_le(&mut self) -> Result<u8, Error>
async fn read_u8_le(&mut self) -> Result<u8, Error>
u8 from the underlying reader.Source§async fn read_u16(&mut self) -> Result<u16, Error>
async fn read_u16(&mut self) -> Result<u16, Error>
u16 from the underlying reader.Source§async fn read_u16_le(&mut self) -> Result<u16, Error>
async fn read_u16_le(&mut self) -> Result<u16, Error>
u16 from the underlying reader.Source§async fn read_u32(&mut self) -> Result<u32, Error>
async fn read_u32(&mut self) -> Result<u32, Error>
u32 from the underlying reader.Source§async fn read_u32_le(&mut self) -> Result<u32, Error>
async fn read_u32_le(&mut self) -> Result<u32, Error>
u32 from the underlying reader.Source§async fn read_u64(&mut self) -> Result<u64, Error>
async fn read_u64(&mut self) -> Result<u64, Error>
u64 from the underlying reader.Source§async fn read_u64_le(&mut self) -> Result<u64, Error>
async fn read_u64_le(&mut self) -> Result<u64, Error>
u64 from the underlying reader.Source§async fn read_u128(&mut self) -> Result<u128, Error>
async fn read_u128(&mut self) -> Result<u128, Error>
u128 from the underlying reader.Source§async fn read_u128_le(&mut self) -> Result<u128, Error>
async fn read_u128_le(&mut self) -> Result<u128, Error>
u128 from the underlying reader.Source§async fn read_i8(&mut self) -> Result<i8, Error>
async fn read_i8(&mut self) -> Result<i8, Error>
i8 from the underlying reader.Source§async fn read_i8_le(&mut self) -> Result<i8, Error>
async fn read_i8_le(&mut self) -> Result<i8, Error>
i8 from the underlying reader.Source§async fn read_i16(&mut self) -> Result<i16, Error>
async fn read_i16(&mut self) -> Result<i16, Error>
i16 from the underlying reader.Source§async fn read_i16_le(&mut self) -> Result<i16, Error>
async fn read_i16_le(&mut self) -> Result<i16, Error>
i16 from the underlying reader.Source§async fn read_i32(&mut self) -> Result<i32, Error>
async fn read_i32(&mut self) -> Result<i32, Error>
i32 from the underlying reader.Source§async fn read_i32_le(&mut self) -> Result<i32, Error>
async fn read_i32_le(&mut self) -> Result<i32, Error>
i32 from the underlying reader.Source§async fn read_i64(&mut self) -> Result<i64, Error>
async fn read_i64(&mut self) -> Result<i64, Error>
i64 from the underlying reader.Source§async fn read_i64_le(&mut self) -> Result<i64, Error>
async fn read_i64_le(&mut self) -> Result<i64, Error>
i64 from the underlying reader.Source§async fn read_i128(&mut self) -> Result<i128, Error>
async fn read_i128(&mut self) -> Result<i128, Error>
i128 from the underlying reader.Source§async fn read_i128_le(&mut self) -> Result<i128, Error>
async fn read_i128_le(&mut self) -> Result<i128, Error>
i128 from the underlying reader.Source§async fn read_f32(&mut self) -> Result<f32, Error>
async fn read_f32(&mut self) -> Result<f32, Error>
f32 from the underlying reader.Source§async fn read_f32_le(&mut self) -> Result<f32, Error>
async fn read_f32_le(&mut self) -> Result<f32, Error>
f32 from the underlying reader.Source§impl<A> AsyncWriteExt for Awhere
A: AsyncWrite + ?Sized,
impl<A> AsyncWriteExt for Awhere
A: AsyncWrite + ?Sized,
Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
AsyncWrite. Read moreSource§async fn write_all<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoBuf,
async fn write_all<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoBuf,
Source§async fn write_vectored_all<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoVectoredBuf,
async fn write_vectored_all<T>(&mut self, buf: T) -> BufResult<(), T>where
T: IoVectoredBuf,
AsyncWrite::write_vectored, except that it tries to write the entire
contents of the buffer into this writer.Source§async fn write_u8(&mut self, num: u8) -> Result<(), Error>
async fn write_u8(&mut self, num: u8) -> Result<(), Error>
u8 into the underlying writer.Source§async fn write_u8_le(&mut self, num: u8) -> Result<(), Error>
async fn write_u8_le(&mut self, num: u8) -> Result<(), Error>
u8 into the underlying writer.Source§async fn write_u16(&mut self, num: u16) -> Result<(), Error>
async fn write_u16(&mut self, num: u16) -> Result<(), Error>
u16 into the underlying writer.Source§async fn write_u16_le(&mut self, num: u16) -> Result<(), Error>
async fn write_u16_le(&mut self, num: u16) -> Result<(), Error>
u16 into the underlying writer.Source§async fn write_u32(&mut self, num: u32) -> Result<(), Error>
async fn write_u32(&mut self, num: u32) -> Result<(), Error>
u32 into the underlying writer.Source§async fn write_u32_le(&mut self, num: u32) -> Result<(), Error>
async fn write_u32_le(&mut self, num: u32) -> Result<(), Error>
u32 into the underlying writer.Source§async fn write_u64(&mut self, num: u64) -> Result<(), Error>
async fn write_u64(&mut self, num: u64) -> Result<(), Error>
u64 into the underlying writer.Source§async fn write_u64_le(&mut self, num: u64) -> Result<(), Error>
async fn write_u64_le(&mut self, num: u64) -> Result<(), Error>
u64 into the underlying writer.Source§async fn write_u128(&mut self, num: u128) -> Result<(), Error>
async fn write_u128(&mut self, num: u128) -> Result<(), Error>
u128 into the underlying writer.Source§async fn write_u128_le(&mut self, num: u128) -> Result<(), Error>
async fn write_u128_le(&mut self, num: u128) -> Result<(), Error>
u128 into the underlying writer.Source§async fn write_i8(&mut self, num: i8) -> Result<(), Error>
async fn write_i8(&mut self, num: i8) -> Result<(), Error>
i8 into the underlying writer.Source§async fn write_i8_le(&mut self, num: i8) -> Result<(), Error>
async fn write_i8_le(&mut self, num: i8) -> Result<(), Error>
i8 into the underlying writer.Source§async fn write_i16(&mut self, num: i16) -> Result<(), Error>
async fn write_i16(&mut self, num: i16) -> Result<(), Error>
i16 into the underlying writer.Source§async fn write_i16_le(&mut self, num: i16) -> Result<(), Error>
async fn write_i16_le(&mut self, num: i16) -> Result<(), Error>
i16 into the underlying writer.Source§async fn write_i32(&mut self, num: i32) -> Result<(), Error>
async fn write_i32(&mut self, num: i32) -> Result<(), Error>
i32 into the underlying writer.Source§async fn write_i32_le(&mut self, num: i32) -> Result<(), Error>
async fn write_i32_le(&mut self, num: i32) -> Result<(), Error>
i32 into the underlying writer.Source§async fn write_i64(&mut self, num: i64) -> Result<(), Error>
async fn write_i64(&mut self, num: i64) -> Result<(), Error>
i64 into the underlying writer.Source§async fn write_i64_le(&mut self, num: i64) -> Result<(), Error>
async fn write_i64_le(&mut self, num: i64) -> Result<(), Error>
i64 into the underlying writer.Source§async fn write_i128(&mut self, num: i128) -> Result<(), Error>
async fn write_i128(&mut self, num: i128) -> Result<(), Error>
i128 into the underlying writer.Source§async fn write_i128_le(&mut self, num: i128) -> Result<(), Error>
async fn write_i128_le(&mut self, num: i128) -> Result<(), Error>
i128 into the underlying writer.Source§async fn write_f32(&mut self, num: f32) -> Result<(), Error>
async fn write_f32(&mut self, num: f32) -> Result<(), Error>
f32 into the underlying writer.Source§async fn write_f32_le(&mut self, num: f32) -> Result<(), Error>
async fn write_f32_le(&mut self, num: f32) -> Result<(), Error>
f32 into the underlying writer.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 more