Skip to main content

ClientSocketBuilder

Struct ClientSocketBuilder 

Source
pub struct ClientSocketBuilder<T: IdentityType + Clone, AE: AsyncExecutor + 'static, CC: ClientConnectionHandler> { /* private fields */ }
Expand description

Builder for constructing a ClientSocket.

Implementations§

Source§

impl<T: IdentityType + Clone + 'static, AE: AsyncExecutor + 'static, CC: ClientConnectionHandler + 'static> ClientSocketBuilder<T, AE, CC>

Source

pub fn new(certificate: ClientCertificate, initial_data_generator: CC) -> Self

Create a new builder with the given certificate and client connection handler. Decoy providers are randomly selected per-flow by default.

The certificate must contain at least one server address; otherwise build will return CertificateError::NoAddresses.

By default, a random number of addresses (1 to the total in the certificate) is selected automatically, each with a random FlowConfig. Call with_flow_config one or more times to opt out of auto-selection and configure exactly which flows to open.

Source

pub fn with_settings(self, settings: Arc<Settings<AE>>) -> Self

Set custom settings to use for the socket.

Source

pub fn with_decoy_factory(self, factory: DecoyFactory<T, AE>) -> Self

Set the decoy factory used for all flows.

Source

pub fn with_decoy<DP: DecoyCommunicationMode<T, AE> + 'static>(self) -> Self

Set a fixed decoy provider type for all flows.

Source

pub fn with_probe_factory(self, factory: ProbeFactory<AE>) -> Self

Set the active probe handler factory for all flows.

Source

pub fn with_probe<PM: ActiveProbeHandler<AE> + Default + 'static>(self) -> Self

Set a fixed active probe handler type for all flows.

Source

pub fn with_flow_config(self, addr: SocketAddr, config: FlowConfig) -> Self

Set an explicit FlowConfig for a specific server address.

Calling this method at least once disables auto-flow-selection: only the addresses configured via this method will be connected. The address must be present in the certificate; otherwise build will return ClientSocketError::AddressNotInCertificate.

Source

pub async fn build(self) -> Result<ClientSocket<T, AE, CC>, ClientSocketError>

Build the client socket, validating all flow configs and creating underlying managers.

Returns ClientSocketError::FlowError wrapping FlowControllerError::AssertionFailed if the combined flow configuration leaves zero bytes available for user data (e.g. constant fake-body mode with a per-flow constant length sampled from [TYPHOON_FAKE_BODY_CONSTANT_LENGTH_MIN, TYPHOON_FAKE_BODY_CONSTANT_LENGTH_MAX] larger than the remaining packet budget after protocol overhead).

Auto Trait Implementations§

§

impl<T, AE, CC> !RefUnwindSafe for ClientSocketBuilder<T, AE, CC>

§

impl<T, AE, CC> !UnwindSafe for ClientSocketBuilder<T, AE, CC>

§

impl<T, AE, CC> Freeze for ClientSocketBuilder<T, AE, CC>
where CC: Freeze,

§

impl<T, AE, CC> Send for ClientSocketBuilder<T, AE, CC>

§

impl<T, AE, CC> Sync for ClientSocketBuilder<T, AE, CC>

§

impl<T, AE, CC> Unpin for ClientSocketBuilder<T, AE, CC>
where CC: Unpin,

§

impl<T, AE, CC> UnsafeUnpin for ClientSocketBuilder<T, AE, CC>
where CC: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

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

Source§

fn vzip(self) -> V