pub struct Setup<IO> { /* private fields */ }Expand description
The setup type being used to configure the kTLS stream.
See Setup::execute for details.
Implementations§
Source§impl<IO> Setup<IO>
impl<IO> Setup<IO>
Sourcepub const fn new_client_stream(inner: TlsStream<CorkStream<IO>>) -> Self
pub const fn new_client_stream(inner: TlsStream<CorkStream<IO>>) -> Self
Initialize a new setup with the socket (that client connects to).
Sourcepub const fn new_server_stream<'a>(inner: TlsStream<CorkStream<IO>>) -> Self
pub const fn new_server_stream<'a>(inner: TlsStream<CorkStream<IO>>) -> Self
Initialize a new setup with the socket (that server accepts).
Sourcepub fn try_recover(&mut self) -> Option<(Option<Vec<u8>>, TlsStream<IO>)>
pub fn try_recover(&mut self) -> Option<(Option<Vec<u8>>, TlsStream<IO>)>
Try to recover from an error. This is used to allow the user to continue using the TLS stream after an error has occurred.
This returns the inner TLS stream and the drained data.
Sourcepub async fn execute(&mut self) -> Result<KtlsStream<IO>, Error>
pub async fn execute(&mut self) -> Result<KtlsStream<IO>, Error>
Execute kTLS configuration for this socket.
If this call succeeds, data can be written and read from this socket, and the kernel takes care of encryption (and key updates, etc.) transparently.
The inner IO type must be wrapped in CorkStream since it’s the only
way to drain a rustls stream cleanly. See its documentation for
details.
For server side, I’m not clear how rekeying is handled (probably via control messages, but can’t find a code sample for it).