Skip to main content

ConnectionInfoBuilder

Struct ConnectionInfoBuilder 

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

Fluent builder for ConnectionInfo.

Provides a separate builder type for constructing ConnectionInfo using snake_case setter methods (version(), cipher_suite(), etc.) rather than the with_* methods on ConnectionInfo itself.

§Example

use oxitls_core::{CipherSuite, ConnectionInfoBuilder, TlsVersion};

let info = ConnectionInfoBuilder::new()
    .version(TlsVersion::Tls13)
    .cipher_suite(CipherSuite::Tls13Aes256GcmSha384)
    .alpn_protocol(b"h2".to_vec())
    .sni("example.com".to_string())
    .build();

assert_eq!(info.version, Some(TlsVersion::Tls13));

Implementations§

Source§

impl ConnectionInfoBuilder

Source

pub fn new() -> Self

Create a new builder with all fields set to None.

Source

pub fn version(self, version: TlsVersion) -> Self

Set the negotiated TLS version.

Source

pub fn cipher_suite(self, suite: CipherSuite) -> Self

Set the negotiated cipher suite.

Source

pub fn alpn_protocol(self, proto: Vec<u8>) -> Self

Set the negotiated ALPN protocol bytes.

Source

pub fn sni(self, sni: String) -> Self

Set the SNI server name.

Source

pub fn peer_certificates(self, certs: Vec<Vec<u8>>) -> Self

Set the peer certificate chain (DER-encoded, leaf first).

Source

pub fn build(self) -> ConnectionInfo

Consume the builder and produce a ConnectionInfo.

Trait Implementations§

Source§

impl Debug for ConnectionInfoBuilder

Source§

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

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

impl Default for ConnectionInfoBuilder

Source§

fn default() -> ConnectionInfoBuilder

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