Skip to main content

ClientTls

Struct ClientTls 

pub struct ClientTls { /* private fields */ }
Expand description

A client’s TLS trust: which server certificate(s) to accept. Use ClientTls::trusting to pin a specific self-signed server certificate.

Implementations§

§

impl ClientTls

pub fn trusting(cert_der: Vec<u8>) -> Result<ClientTls, Error>

Trust the given certificate (DER bytes) as the one root: a self-signed server certificate, or a private CA’s certificate, rather than the public web PKI. It is a trust anchor, not a pin: a leaf issued by a CA does not verify against itself, and a CA here admits every certificate it issues for the name the client asks for.

pub fn trusting_pem(pem: &[u8]) -> Result<ClientTls, Error>

trusting for PEM: every certificate in pem becomes a trust anchor, so a private CA’s certificate, or a full chain pasted leaf-first, both work. This is how a service document carries a private trust root (tacenta-discovery’s private-ca mode).

pub async fn wrap<S>( &self, server_name: &str, stream: S, ) -> Result<impl AsyncRead + AsyncWrite + Unpin + Send + use<S>, Error>
where S: AsyncRead + AsyncWrite + Unpin + Send,

Wrap an already-connected stream in TLS to a server presenting server_name, under this trust. The four connect_tls paths and the gateway’s WebSocket carriage all reach TLS through here.

pub async fn wrap_tcp( &self, server_name: &str, tcp: TcpStream, ) -> Result<TlsStream<TcpStream>, Error>

wrap for a TCP stream, with the concrete TLS stream type, for a caller that stores it in an enum.

pub fn web_pki() -> ClientTls

Trust the public web PKI (Mozilla’s CA root store) — for connecting to a hosted server whose certificate is from a public CA such as Let’s Encrypt. This is the trust a client uses against tacenta.com.

Trait Implementations§

§

impl Clone for ClientTls

§

fn clone(&self) -> ClientTls

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

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>,

Source§

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V