Struct fluvio_future::rust_tls::TlsConnector
source · [−]pub struct TlsConnector { /* private fields */ }Expand description
The TLS connecting part. The acceptor drives the client side of the TLS handshake process. It works on any asynchronous stream.
It provides a simple interface (connect), returning a future
that will resolve when the handshake process completed. On
success, it will hand you an async TlsStream.
To create a TlsConnector with a non-default configuation, create
a rusttls::ClientConfig and call .into() on it.
Example
use fluvio_async_tls::TlsConnector;
async_std::task::block_on(async {
let connector = TlsConnector::default();
let tcp_stream = async_std::net::TcpStream::connect("example.com").await?;
let encrypted_stream = connector.connect("example.com", tcp_stream).await?;
Ok(()) as async_std::io::Result<()>
});Implementations
sourceimpl TlsConnector
impl TlsConnector
sourcepub fn new() -> TlsConnector
pub fn new() -> TlsConnector
Create a new TlsConnector with default configuration.
This is the same as calling TlsConnector::default().
sourcepub fn connect<IO>(&self, domain: impl AsRef<str>, stream: IO) -> Connect<IO>ⓘNotable traits for Connect<IO>impl<IO> Future for Connect<IO> where
IO: AsyncRead + AsyncWrite + Unpin, type Output = Result<TlsStream<IO>, Error>; where
IO: AsyncRead + AsyncWrite + Unpin,
pub fn connect<IO>(&self, domain: impl AsRef<str>, stream: IO) -> Connect<IO>ⓘNotable traits for Connect<IO>impl<IO> Future for Connect<IO> where
IO: AsyncRead + AsyncWrite + Unpin, type Output = Result<TlsStream<IO>, Error>; where
IO: AsyncRead + AsyncWrite + Unpin,
IO: AsyncRead + AsyncWrite + Unpin, type Output = Result<TlsStream<IO>, Error>;
Connect to a server. stream can be any type implementing AsyncRead and AsyncWrite,
such as TcpStreams or Unix domain sockets.
The function will return a Connect Future, representing the connecting part of a Tls
handshake. It will resolve when the handshake is over.
Trait Implementations
sourceimpl Clone for TlsConnector
impl Clone for TlsConnector
sourcefn clone(&self) -> TlsConnector
fn clone(&self) -> TlsConnector
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl Default for TlsConnector
impl Default for TlsConnector
sourcefn default() -> TlsConnector
fn default() -> TlsConnector
Returns the “default value” for a type. Read more
sourceimpl From<Arc<ClientConfig>> for TlsConnector
impl From<Arc<ClientConfig>> for TlsConnector
sourcefn from(inner: Arc<ClientConfig>) -> TlsConnector
fn from(inner: Arc<ClientConfig>) -> TlsConnector
Converts to this type from the input type.
sourceimpl From<ClientConfig> for TlsConnector
impl From<ClientConfig> for TlsConnector
sourcefn from(inner: ClientConfig) -> TlsConnector
fn from(inner: ClientConfig) -> TlsConnector
Converts to this type from the input type.
sourceimpl From<TlsConnector> for TlsAnonymousConnector
impl From<TlsConnector> for TlsAnonymousConnector
sourcefn from(connector: TlsConnector) -> Self
fn from(connector: TlsConnector) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl !RefUnwindSafe for TlsConnector
impl Send for TlsConnector
impl Sync for TlsConnector
impl Unpin for TlsConnector
impl !UnwindSafe for TlsConnector
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output; where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output; where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T> where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more