Struct quinn_proto::EndpointConfig
source · pub struct EndpointConfig { /* private fields */ }
Expand description
Global configuration for the endpoint, affecting all connections
Default values should be suitable for most internet applications.
Implementations§
source§impl EndpointConfig
impl EndpointConfig
sourcepub fn new(reset_key: Arc<dyn HmacKey>) -> Self
pub fn new(reset_key: Arc<dyn HmacKey>) -> Self
Create a default config with a particular reset_key
sourcepub fn cid_generator<F: Fn() -> Box<dyn ConnectionIdGenerator> + Send + Sync + 'static>(
&mut self,
factory: F,
) -> &mut Self
pub fn cid_generator<F: Fn() -> Box<dyn ConnectionIdGenerator> + Send + Sync + 'static>( &mut self, factory: F, ) -> &mut Self
Supply a custom connection ID generator factory
Called once by each Endpoint
constructed from this configuration to obtain the CID
generator which will be used to generate the CIDs used for incoming packets on all
connections involving that Endpoint
. A custom CID generator allows applications to embed
information in local connection IDs, e.g. to support stateless packet-level load balancers.
Defaults to HashedConnectionIdGenerator
.
sourcepub fn reset_key(&mut self, key: Arc<dyn HmacKey>) -> &mut Self
pub fn reset_key(&mut self, key: Arc<dyn HmacKey>) -> &mut Self
Private key used to send authenticated connection resets to peers who were communicating with a previous instance of this endpoint.
sourcepub fn max_udp_payload_size(
&mut self,
value: u16,
) -> Result<&mut Self, ConfigError>
pub fn max_udp_payload_size( &mut self, value: u16, ) -> Result<&mut Self, ConfigError>
Maximum UDP payload size accepted from peers (excluding UDP and IP overhead).
Must be greater or equal than 1200.
Defaults to 1472, which is the largest UDP payload that can be transmitted in the typical 1500 byte Ethernet MTU. Deployments on links with larger MTUs (e.g. loopback or Ethernet with jumbo frames) can raise this to improve performance at the cost of a linear increase in datagram receive buffer size.
sourcepub fn supported_versions(&mut self, supported_versions: Vec<u32>) -> &mut Self
pub fn supported_versions(&mut self, supported_versions: Vec<u32>) -> &mut Self
Override supported QUIC versions
sourcepub fn grease_quic_bit(&mut self, value: bool) -> &mut Self
pub fn grease_quic_bit(&mut self, value: bool) -> &mut Self
Whether to accept QUIC packets containing any value for the fixed bit
Enabled by default. Helps protect against protocol ossification and makes traffic less identifiable to observers. Disable if helping observers identify this traffic as QUIC is desired.
sourcepub fn min_reset_interval(&mut self, value: Duration) -> &mut Self
pub fn min_reset_interval(&mut self, value: Duration) -> &mut Self
Minimum interval between outgoing stateless reset packets
Defaults to 20ms. Limits the impact of attacks which flood an endpoint with garbage packets,
e.g. ISAKMP/IKE amplification. Larger values provide a stronger defense, but may delay
detection of some error conditions by clients. Using a ConnectionIdGenerator
with a low
rate of false positives in validate
reduces the risk
incurred by a small minimum reset interval.
sourcepub fn rng_seed(&mut self, seed: Option<[u8; 32]>) -> &mut Self
pub fn rng_seed(&mut self, seed: Option<[u8; 32]>) -> &mut Self
Optional seed to be used internally for random number generation
By default, quinn will initialize an endpoint’s rng using a platform entropy source. However, you can seed the rng yourself through this method (e.g. if you need to run quinn deterministically or if you are using quinn in an environment that doesn’t have a source of entropy available).
Trait Implementations§
source§impl Clone for EndpointConfig
impl Clone for EndpointConfig
source§fn clone(&self) -> EndpointConfig
fn clone(&self) -> EndpointConfig
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EndpointConfig
impl Debug for EndpointConfig
Auto Trait Implementations§
impl Freeze for EndpointConfig
impl !RefUnwindSafe for EndpointConfig
impl Send for EndpointConfig
impl Sync for EndpointConfig
impl Unpin for EndpointConfig
impl !UnwindSafe for EndpointConfig
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)