Struct pipebuf_rustls::TlsClient

source ·
pub struct TlsClient { /* private fields */ }
Expand description

PipeBuf wrapper of Rustls ClientConnection

If TLS is not configured then just passes data through unchanged.

There is a single “process” call that takes care of all the calls required to move data between the encrypted and plain-text sides of a Rustls ClientConnection.

Implementations§

source§

impl TlsClient

source

pub fn new( config: Option<(Arc<ClientConfig>, ServerName<'static>)> ) -> Result<Self, Error>

Create a new TLS engine using the given Rustls configuration, or set it up to just pass data straight through if there is no configuration provided

source

pub fn process( &mut self, ext: PBufRdWr<'_>, int: PBufRdWr<'_> ) -> Result<bool, TlsError>

Process as much data as possible, moving data between ext and int. ext is the pipe which typically carries TLS protocol data to/from an external TCP connection. int is the pipe carrying plain-text data to/from whatever handlers there are on the internal side.

If TLS is disabled, this just passes data straight through.

Normal “Closing” end-of-file indicated from the internal side is converted into a TLS close_notify, i.e. a clean TLS shutdown. “Aborting” end-of-file causes the TLS protocol stream to be abruptly closed, which will result in an “aborted” end-of-file status at the remote end.

A clean close_notify end-of-file received by TLS from the external side results in a normal “Closing” end-of-file being indicated for the internal handlers. Any other end-of-file results in an “Aborting” end-of-file. Note that some TLS libraries always end their streams with an unclean shutdown.

Returns Ok(true) if there was activity, Ok(false) if no progress could be made, and Err(_) if there was an error.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.