Skip to main content

TlsServerConfigBuilder

Struct TlsServerConfigBuilder 

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

Builder for TlsServerConfig.

Implementations§

Source§

impl TlsServerConfigBuilder

Source

pub fn new() -> Self

Create an empty builder (ALPN defaults to crate http2 feature).

Source

pub fn http2(self, enabled: bool) -> Self

Advertise H2 before HTTP/1.1 when true (default follows the crate http2 feature). Coherent with RuntimeConfig::http2.enabled. Clears any explicit Self::alpn_protocols override (last call wins).

Source

pub fn alpn_protocols(self, protocols: Vec<Vec<u8>>) -> Result<Self, TlsError>

Advertise an explicit ALPN list instead of the HTTP convenience.

Neutral hook for non-HTTP transports (Plan 222): proxy or custom transports supply their own protocol identifiers. An empty list advertises no ALPN. Entries are bounded (MAX_ALPN_PROTOCOLS × MAX_ALPN_PROTOCOL_LEN); out-of-range input fails here, never at the first handshake. Overrides Self::http2 (last call wins).

Source

pub fn add_identity( self, name: &str, certs: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Result<Self, TlsError>

Add one SNI identity (exact DNS or *.suffix wildcard).

Source

pub fn default_identity( self, certs: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Result<Self, TlsError>

Set the default identity for no-SNI/no-match clients.

Source

pub fn single_identity( self, certs: Vec<CertificateDer<'static>>, key: PrivateKeyDer<'static>, ) -> Result<Self, TlsError>

Convenience for a single identity (default-only, SNI-agnostic).

Source

pub fn client_auth_disabled(self) -> Self

Disable client authentication (default).

Source

pub fn client_auth_required( self, roots: Vec<CertificateDer<'static>>, ) -> Result<Self, TlsError>

Require client certificates verified against roots.

Source

pub fn client_auth_optional( self, roots: Vec<CertificateDer<'static>>, ) -> Result<Self, TlsError>

Offer client authentication; allow unauthenticated clients.

Source

pub fn with_crls( self, crls: Vec<CertificateRevocationListDer<'static>>, ) -> Result<Self, TlsError>

Attach CRLs to the current client-auth policy (explicit revocation).

Without CRLs no revocation checking is implied. Bounded and validated at build time.

Source

pub fn build(self) -> Result<TlsServerConfig, TlsError>

Build the validated TlsServerConfig.

Fails before readiness on invalid names, key/cert mismatch, empty trust, or unparsable CRLs. Never defers obvious pairing errors to the first hostile connection.

Trait Implementations§

Source§

impl Debug for TlsServerConfigBuilder

Source§

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

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

impl Default for TlsServerConfigBuilder

Source§

fn default() -> Self

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.