Skip to main content

Module rustls

Module rustls 

Source
Expand description

Rustls client/server providers over Base scheduler stream sockets. Enable the rustls feature, supply an Arc<ClientConfig> or Arc<ServerConfig>, and compose the provider with the generic TLS endpoint adapters.

Rustls connections take the scheduler explicitly for each operation. write reports plaintext accepted into buffering; call flush to send the final buffered output. Reads also drive pending TLS control output. shutdown sends close_notify while leaving reads available; close attempts shutdown and always closes the transport, even after cancellation. abort closes without a TLS notification. Await cancelled operations before closure. Partial ciphertext output is retained for a later flush, so accepted plaintext must not be replayed. Missing peer close_notify is reported as UnexpectedEof after buffered plaintext is consumed. TlsStream retains the sequential interface. No runtime or background task is created.

RustlsConnection::with_duplex runs an application with independent plaintext reader and writer handles over one TLS connection while explicitly driving network input/output over persistent scheduler capabilities. The writer directly polls one retained transmitter future; successful writes need no supervisor handoff. A stable socket waker reaches both foreground and supervised pollers when output blocks. The writer handle carries the scheduler lifetime, while the codec and body types remain unchanged. Application reads drive the retained receiver until authenticated plaintext is available; input does not read ahead while plaintext awaits consumption. Control output and directional cleanup remain supervised. Incoming TLS control records are processed when the application reads. No lock spans an asynchronous wait, and no task is spawned. Await its completion to join lane retirement and socket closure.

Structs§

EncryptedSocketStreamReader
Plaintext input which drives its retained TLS receive future. No lock spans an asynchronous wait; paused input does not prevent application output.
EncryptedSocketStreamWriter
Ordered plaintext output. Writes accept a bounded prefix into TLS; flush waits for its ciphertext to reach the socket. No transport lock spans await.
RustlsAcceptor
A rustls server provider using application-supplied certificates, client-authentication policy and ALPN configuration.
RustlsConnection
An established rustls connection owning its scheduler socket and TLS buffers. Sequential operations take the compatible scheduler explicitly; with_duplex additionally supervises concurrent plaintext directions. Await operations after cooperative cancellation before closing; dropping an operation provides no asynchronous retirement guarantee.
RustlsConnector
A rustls client provider using application-supplied trust, identity and ALPN configuration. DNS names and IP literals are verified by the configuration’s certificate verifier. No system trust roots are loaded implicitly.