Skip to main content

TlsProvider

Trait TlsProvider 

Source
pub trait TlsProvider<S: StreamOps>:
    Clone
    + Send
    + Sync
    + 'static {
    type Connector: TlsConnector<S, Conn = Self::TlsStream> + Send + Sync + Unpin;
    type TlsStream: AsyncRead + AsyncWrite + StreamOps + CertifiedConn + Unpin + Send + 'static;
    type Acceptor: TlsConnector<S, Conn = Self::TlsServerStream> + Send + Sync + Unpin;
    type TlsServerStream: AsyncRead + AsyncWrite + StreamOps + CertifiedConn + Unpin + Send + 'static;

    // Required methods
    fn tls_connector(&self) -> Self::Connector;
    fn tls_acceptor(
        &self,
        settings: TlsAcceptorSettings,
    ) -> IoResult<Self::Acceptor>;
    fn supports_keying_material_export(&self) -> bool;
}
Expand description

Trait for a runtime that knows how to create TLS connections over TCP streams of type S.

This is separate from TlsConnector because eventually we may eventually want to support multiple TlsConnector implementations that use a single Runtime.

See the TlsConnector documentation for a discussion of the Tor-specific limitations of this trait: If you are implementing something other than Tor, this is not the functionality you want.

Required Associated Types§

Source

type Connector: TlsConnector<S, Conn = Self::TlsStream> + Send + Sync + Unpin

The Connector object that this provider can return.

Source

type TlsStream: AsyncRead + AsyncWrite + StreamOps + CertifiedConn + Unpin + Send + 'static

The type of the stream returned by that connector.

Source

type Acceptor: TlsConnector<S, Conn = Self::TlsServerStream> + Send + Sync + Unpin

The Acceptor object that this provider can return, for handling incoming connections.

Source

type TlsServerStream: AsyncRead + AsyncWrite + StreamOps + CertifiedConn + Unpin + Send + 'static

The type of stream returned by that Acceptor.

Required Methods§

Source

fn tls_connector(&self) -> Self::Connector

Return a TLS connector for use with this runtime.

Source

fn tls_acceptor( &self, settings: TlsAcceptorSettings, ) -> IoResult<Self::Acceptor>

Return a TLS acceptor for use with this runtime.

Not every TlsProvider supports this method. For those that do, this method is only supported when tor-rtcompat is built with the tls-server feature. When this method is unsupported, it returns an error.

Source

fn supports_keying_material_export(&self) -> bool

Return true iff the keying material exporters (RFC 5705) is supported.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S> TlsProvider<S> for AsyncStdNativeTlsRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and crate feature async-std only.
Source§

impl<S> TlsProvider<S> for AsyncStdRustlsRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and crate feature async-std only.
Source§

impl<S> TlsProvider<S> for SmolNativeTlsRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and crate feature smol only.
Source§

type Connector = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, NativeTlsProvider, SmolRuntime> as TlsProvider<S>>::Connector

Source§

type TlsStream = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, NativeTlsProvider, SmolRuntime> as TlsProvider<S>>::TlsStream

Source§

type Acceptor = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, NativeTlsProvider, SmolRuntime> as TlsProvider<S>>::Acceptor

Source§

type TlsServerStream = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, NativeTlsProvider, SmolRuntime> as TlsProvider<S>>::TlsServerStream

Source§

impl<S> TlsProvider<S> for SmolRustlsRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and crate feature smol only.
Source§

type Connector = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, RustlsProvider, SmolRuntime> as TlsProvider<S>>::Connector

Source§

type TlsStream = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, RustlsProvider, SmolRuntime> as TlsProvider<S>>::TlsStream

Source§

type Acceptor = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, RustlsProvider, SmolRuntime> as TlsProvider<S>>::Acceptor

Source§

type TlsServerStream = <CompoundRuntime<SmolRuntime, SmolRuntime, RealCoarseTimeProvider, SmolRuntime, SmolRuntime, RustlsProvider, SmolRuntime> as TlsProvider<S>>::TlsServerStream

Source§

impl<S> TlsProvider<S> for PreferredRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Source§

impl<S> TlsProvider<S> for NativeTlsProvider
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and (crate features async-std or tokio or smol) and crate feature native-tls only.
Source§

impl<S> TlsProvider<S> for RustlsProvider
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and (crate features async-std or tokio or smol) and crate feature rustls only.
Source§

impl<S> TlsProvider<S> for TokioNativeTlsRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and crate feature tokio only.
Source§

type Connector = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, NativeTlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::Connector

Source§

type TlsStream = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, NativeTlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::TlsStream

Source§

type Acceptor = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, NativeTlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::Acceptor

Source§

type TlsServerStream = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, NativeTlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::TlsServerStream

Source§

impl<S> TlsProvider<S> for TokioRustlsRuntime
where S: AsyncRead + AsyncWrite + StreamOps + Unpin + Send + 'static,

Available on (crate features native-tls or rustls) and crate feature tokio only.
Source§

type Connector = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, RustlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::Connector

Source§

type TlsStream = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, RustlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::TlsStream

Source§

type Acceptor = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, RustlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::Acceptor

Source§

type TlsServerStream = <CompoundRuntime<TokioRuntimeHandle, TokioRuntimeHandle, RealCoarseTimeProvider, TokioRuntimeHandle, TokioRuntimeHandle, RustlsProvider, TokioRuntimeHandle> as TlsProvider<S>>::TlsServerStream

Source§

impl<TaskR, SleepR, CoarseTimeR, TcpR, UnixR, TlsR, UdpR, S> TlsProvider<S> for CompoundRuntime<TaskR, SleepR, CoarseTimeR, TcpR, UnixR, TlsR, UdpR>
where TcpR: NetStreamProvider, TlsR: TlsProvider<S>, UnixR: Clone + Send + Sync + 'static, SleepR: Clone + Send + Sync + 'static, CoarseTimeR: Clone + Send + Sync + 'static, TaskR: Clone + Send + Sync + 'static, UdpR: Clone + Send + Sync + 'static, S: StreamOps,