pub struct ServerSession { /* fields omitted */ }
This represents a single TLS server session.
Send TLS-protected data to the peer using the io::Write
trait implementation.
Read data from the peer using the io::Read
trait implementation.
Make a new ServerSession. config
controls how
we behave in the TLS protocol.
Retrieves the SNI hostname, if any, used to select the certificate and
private key.
This returns None
until some time after the client's SNI extension
value is processed during the handshake. It will never be None
when
the connection is ready to send or process application data, unless the
client does not support SNI.
This is useful for application protocols that need to enforce that the
SNI hostname matches an application layer protocol hostname. For
example, HTTP/1.1 servers commonly expect the Host:
header field of
every request on a connection to match the hostname in the SNI extension
when the client provides the SNI extension.
The SNI hostname is also used to match sessions during session
resumption.
Read TLS content from rd
. This method does internal buffering, so rd
can supply TLS messages in arbitrary- sized chunks (like a socket or pipe might). Read more
Writes TLS messages to wr
.
Like write_tls
, but writes potentially many records in one go via wr
; a rustls::WriteV
. This function has the same semantics as write_tls
otherwise. Read more
Processes any new packets read by a previous call to read_tls
. Errors from this function relate to TLS protocol errors, and are fatal to the session. Future calls after an error will do no new work and will return the same error. Read more
Returns true if the caller should call read_tls
as soon as possible. Read more
Returns true if the caller should call write_tls
as soon as possible. Read more
Returns true if the session is currently perform the TLS handshake. During this time plaintext written to the session is buffered in memory. Read more
Sets a limit on the internal buffers used to buffer unsent plaintext (prior to completing the TLS handshake) and unsent TLS records. Read more
Queues a close_notify fatal alert to be sent in the next write_tls
call. This informs the peer that the connection is being closed. Read more
Retrieves the certificate chain used by the peer to authenticate. Read more
Retrieves the protocol agreed with the peer via ALPN. Read more
Retrieves the protocol version agreed with the peer. Read more
Derives key material from the agreed session secrets. Read more
Retrieves the ciphersuite agreed with the peer. Read more
This function uses io
to complete any outstanding IO for this session. Read more
Formats the value using the given formatter. Read more
Obtain plaintext data received from the peer over
this TLS connection.
🔬 This is a nightly-only experimental API. (read_initializer
)
Determines if this Read
er can work with buffers of uninitialized memory. Read more
Read all bytes until EOF in this source, placing them into buf
. Read more
Read all bytes until EOF in this source, appending them to buf
. Read more
Read the exact number of bytes required to fill buf
. Read more
Creates a "by reference" adaptor for this instance of Read
. Read more
Transforms this Read
instance to an [Iterator
] over its bytes. Read more
Creates an adaptor which will chain this stream with another. Read more
Creates an adaptor which will read at most limit
bytes from it. Read more
Send the plaintext buf
to the peer, encrypting
and authenticating it. Once this function succeeds
you should call write_tls
which will output the
corresponding TLS records.
This function buffers plaintext sent before the
TLS handshake completes, and sends it as soon
as it can. This buffer is of unlimited size so
writing much data before it can be sent will
cause excess memory usage.
Flush this output stream, ensuring that all intermediately buffered contents reach their destination. Read more
Attempts to write an entire buffer into this writer. Read more
Writes a formatted string into this writer, returning any error encountered. Read more
Creates a "by reference" adaptor for this instance of Write
. Read more
type Error = !
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
type Error = <U as TryFrom<T>>::Error
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
impl<R> ReadBytesExt for R where R: Read + ?Sized, | |
Reads an unsigned 8 bit integer from the underlying reader. Read more
Reads a signed 8 bit integer from the underlying reader. Read more
Reads an unsigned 16 bit integer from the underlying reader. Read more
Reads a signed 16 bit integer from the underlying reader. Read more
Reads an unsigned 24 bit integer from the underlying reader. Read more
Reads a signed 24 bit integer from the underlying reader. Read more
Reads an unsigned 32 bit integer from the underlying reader. Read more
Reads a signed 32 bit integer from the underlying reader. Read more
Reads an unsigned 48 bit integer from the underlying reader. Read more
Reads a signed 48 bit integer from the underlying reader. Read more
Reads an unsigned 64 bit integer from the underlying reader. Read more
Reads a signed 64 bit integer from the underlying reader. Read more
Reads an unsigned 128 bit integer from the underlying reader. Read more
Reads a signed 128 bit integer from the underlying reader. Read more
Reads an unsigned n-bytes integer from the underlying reader. Read more
Reads a signed n-bytes integer from the underlying reader. Read more
Reads an unsigned n-bytes integer from the underlying reader.
Reads a signed n-bytes integer from the underlying reader.
Reads a IEEE754 single-precision (4 bytes) floating point number from the underlying reader. Read more
Reads a IEEE754 double-precision (8 bytes) floating point number from the underlying reader. Read more
Reads a sequence of unsigned 16 bit integers from the underlying reader. Read more
Reads a sequence of unsigned 32 bit integers from the underlying reader. Read more
Reads a sequence of unsigned 64 bit integers from the underlying reader. Read more
Reads a sequence of unsigned 128 bit integers from the underlying reader. Read more
Reads a sequence of signed 16 bit integers from the underlying reader. Read more
Reads a sequence of signed 32 bit integers from the underlying reader. Read more
Reads a sequence of signed 64 bit integers from the underlying reader. Read more
Reads a sequence of signed 128 bit integers from the underlying reader. Read more
Reads a sequence of IEEE754 single-precision (4 bytes) floating point numbers from the underlying reader. Read more
Deprecated since 1.2.0:
please use read_f32_into
instead
Reads a sequence of IEEE754 double-precision (8 bytes) floating point numbers from the underlying reader. Read more
Deprecated since 1.2.0:
please use read_f64_into
instead
impl<W> WriteBytesExt for W where W: Write + ?Sized, | |
Writes an unsigned 8 bit integer to the underlying writer. Read more
Writes a signed 8 bit integer to the underlying writer. Read more
Writes an unsigned 16 bit integer to the underlying writer. Read more
Writes a signed 16 bit integer to the underlying writer. Read more
Writes an unsigned 24 bit integer to the underlying writer. Read more
Writes a signed 24 bit integer to the underlying writer. Read more
Writes an unsigned 32 bit integer to the underlying writer. Read more
Writes a signed 32 bit integer to the underlying writer. Read more
Writes an unsigned 48 bit integer to the underlying writer. Read more
Writes a signed 48 bit integer to the underlying writer. Read more
Writes an unsigned 64 bit integer to the underlying writer. Read more
Writes a signed 64 bit integer to the underlying writer. Read more
Writes an unsigned 128 bit integer to the underlying writer.
Writes a signed 128 bit integer to the underlying writer.
Writes an unsigned n-bytes integer to the underlying writer. Read more
Writes a signed n-bytes integer to the underlying writer. Read more
Writes an unsigned n-bytes integer to the underlying writer. Read more
Writes a signed n-bytes integer to the underlying writer. Read more
Writes a IEEE754 single-precision (4 bytes) floating point number to the underlying writer. Read more
Writes a IEEE754 double-precision (8 bytes) floating point number to the underlying writer. Read more