Struct Builder

Source
pub struct Builder { /* private fields */ }
Expand description

Builder for Config.

§Example

let mut config = Builder::new()
    .keypair_mem(cert, key, None)
    .ticket_key(1, &ticket_key1)
    .ticket_key(2, &ticket_key2)
    .protocols(TLS_PROTOCOLS_ALL)
    .ecdhecurves("X25519")
    .alpn("h2")
    .build()?;

Implementations§

Source§

impl Builder

Source

pub fn new() -> Self

Return new Builder.

§See also

Config

Source

pub fn build(&self) -> Result<Config>

Build new Config object.

§See also

Config

Source

pub fn client(&self) -> Result<Tls>

Build new Config object and return a configured Tls client.

§See also

Tls, Config

Source

pub fn server(&self) -> Result<Tls>

Build new Config object and return a configured Tls server.

§See also

Tls, Config

Source

pub fn alpn(&mut self, alpn: &str) -> &mut Self

Set the ALPN protocols that are supported.

§See also

Config::set_alpn

Source

pub fn ca_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Set the CA file.

§See also

Config::set_ca_file

Source

pub fn ca_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Set the CA path.

§See also

Config::set_ca_path

Source

pub fn ca_mem(&mut self, mem: &[u8]) -> &mut Self

Set the CA from memory.

§See also

Config::set_ca_mem

Source

pub fn ciphers(&mut self, ciphers: &str) -> &mut Self

Set the list of cipher that may be used.

§See also

Config::set_ciphers

Source

pub fn crl_file<P: AsRef<Path>>(&mut self, path: P) -> &mut Self

Set the CRL file.

§See also

Config::set_crl_file

Source

pub fn crl_mem(&mut self, mem: &[u8]) -> &mut Self

Set the CRL from memory.

§See also

Config::set_crl_mem

Source

pub fn dheparams(&mut self, dheparams: &str) -> &mut Self

Set the parameters of an Diffie-Hellman Ephemeral (DHE) key exchange.

§See also

Config::set_dheparams

Source

pub fn ecdhecurves(&mut self, ecdhecurves: &str) -> &mut Self

Set the curves of an Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) key exchange.

§See also

Config::set_ecdhecurves

Source

pub fn keypair_file<P: AsRef<Path>>( &mut self, cert: P, key: P, ocsp_staple: Option<P>, ) -> &mut Self

Add additional files of a public and private key pair and OCSP staple.

§See also

Config::add_keypair_file, Config::set_keypair_file

Source

pub fn keypair_mem( &mut self, cert: &[u8], key: &[u8], ocsp_staple: Option<&[u8]>, ) -> &mut Self

Add an additional public and private key pair and OCSP staple from memory.

§See also

Config::set_keypair_mem, Config::set_keypair_mem

Source

pub fn noverifycert(&mut self) -> &mut Self

Disable certificate verification.

§See also

Config::insecure_noverifycert

Source

pub fn noverifyname(&mut self) -> &mut Self

Disable server name verification.

§See also

Config::insecure_noverifyname

Source

pub fn noverifytime(&mut self) -> &mut Self

Disable certificate validity checking.

§See also

Config::insecure_noverifytime

Source

pub fn protocols(&mut self, protocols: u32) -> &mut Self

Set which versions of the TLS protocol may be used.

§See also

Config::set_protocols

Source

pub fn session_fd(&mut self, fd: RawFd) -> &mut Self

Set a file descriptor to manage data for TLS sessions.

§See also

Config::set_session_fd

Source

pub fn session_id(&mut self, id: &[u8]) -> &mut Self

Set the session identifier for TLS sessions.

§See also

Config::set_session_id

Source

pub fn session_lifetime(&mut self, lifetime: usize) -> &mut Self

Set the lifetime for TLS sessions.

§See also

Config::set_session_lifetime

Source

pub fn ticket_key(&mut self, keyrev: u32, key: &[u8]) -> &mut Self

Source

pub fn verify(&mut self) -> &mut Self

Enable all certificate verification.

§See also

Config::verify

Source

pub fn verify_client(&mut self) -> &mut Self

Enable client certificate verification.

§See also

Config::verify_client

Source

pub fn verify_client_optional(&mut self) -> &mut Self

Enable optional client certificate verification.

§See also

Config::verify_client_optional

Source

pub fn verify_depth(&mut self, depth: usize) -> &mut Self

Set the certificate verification depth.

§See also

Config::verify_depth

Trait Implementations§

Source§

impl Clone for Builder

Source§

fn clone(&self) -> Builder

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Builder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Builder

Source§

fn default() -> Builder

Returns the “default value” for a type. 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
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.

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.