Skip to main content

EndpointConfig

Struct EndpointConfig 

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

Global configuration for the endpoint, affecting all associations

Default values should be suitable for most internet applications.

Implementations§

Source§

impl EndpointConfig

Source

pub fn new() -> Self

Create a default configuration

Source

pub fn random_source( &mut self, provider: Arc<dyn RTCCryptoProvider>, ) -> &mut Self

Draws every random value of the endpoint and its associations from provider’s random(): the verification tags (with the default generator, which this replaces; set Self::aid_generator after this call for another), the initial TSNs, the State Cookies made without ServerConfig::cookie_authentication, the Initiate Tag of an INIT ACK for an existing association, HEARTBEAT nonces and the HEARTBEAT timer’s jitter.

Without it (the default) they come from rand’s thread-local CSPRNG. This is how the other crates of the workspace take their randomness (docs/randomness-audit.md), and what lets a test that seeds the provider replay a run exactly.

Source

pub fn aid_generator<F: Fn() -> Box<dyn AssociationIdGenerator + Send> + Send + Sync + 'static>( &mut self, factory: F, ) -> &mut Self

Supply a custom Association ID generator factory

Called once by each Endpoint constructed from this configuration to obtain the AID generator which will be used to generate the AIDs used for incoming packets on all associations involving that Endpoint. A custom AID generator allows applications to embed information in local association IDs, e.g. to support stateless packet-level load balancers.

EndpointConfig::new() applies a default random AID generator factory. This functions accepts any customized AID generator to reset AID generator factory that implements the AssociationIdGenerator trait.

Source

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

Maximum payload size accepted from peers.

The default is suitable for typical internet applications. Applications which expect to run on networks supporting Ethernet jumbo frames or similar should set this appropriately.

Source

pub fn get_max_payload_size(&self) -> u32

Get the current value of max_payload_size

While most parameters don’t need to be readable, this must be exposed to allow higher-level layers to determine how large a receive buffer to allocate to support an externally-defined EndpointConfig.

While get_ accessors are typically unidiomatic in Rust, we favor concision for setters, which will be used far more heavily.

Trait Implementations§

Source§

impl Clone for EndpointConfig

Source§

fn clone(&self) -> Self

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

impl Debug for EndpointConfig

Source§

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

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

impl Default for EndpointConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for EndpointConfig

§

impl !UnwindSafe for EndpointConfig

§

impl Forget for EndpointConfig

§

impl Freeze for EndpointConfig
where *const ArcInner<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send> is !null: Freeze, PhantomData<ArcInner<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send>>: Freeze, *const ArcInner<dyn RTCCryptoProvider> is !null: Freeze, PhantomData<ArcInner<dyn RTCCryptoProvider>>: Freeze,

§

impl Move for EndpointConfig

§

impl Send for EndpointConfig
where Arc<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send>: Send, Arc<dyn RTCCryptoProvider>: Send,

§

impl Sync for EndpointConfig
where Arc<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send>: Sync, Arc<dyn RTCCryptoProvider>: Sync,

§

impl Unpin for EndpointConfig
where Arc<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send>: Unpin, Arc<dyn RTCCryptoProvider>: Unpin,

§

impl UnsafeUnpin for EndpointConfig
where *const ArcInner<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn Fn() -> Box<dyn AssociationIdGenerator + Send> + Sync + Send>>: UnsafeUnpin, *const ArcInner<dyn RTCCryptoProvider> is !null: UnsafeUnpin, PhantomData<ArcInner<dyn RTCCryptoProvider>>: 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<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 = !

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.