pub struct EndpointConfig { /* private fields */ }展开描述
端点的全局配置,会影响所有连接
默认值应该适合大多数互联网应用。
实现§
源代码§impl EndpointConfig
impl EndpointConfig
源代码pub fn new(reset_key: Arc<dyn HmacKey>) -> EndpointConfig
pub fn new(reset_key: Arc<dyn HmacKey>) -> EndpointConfig
使用指定的 reset_key 创建一个默认配置
源代码pub fn cid_generator<F>(&mut self, factory: F) -> &mut EndpointConfig
pub fn cid_generator<F>(&mut self, factory: F) -> &mut EndpointConfig
提供一个自定义的连接 ID 生成器工厂
每个由本配置构造的 Endpoint 都会调用一次该工厂,以获取 CID 生成器,用于为该 Endpoint 所涉及的所有连接的入站包生成 CID。自定义 CID 生成器允许应用程序在本地连接 ID 中嵌入信息,例如支持无状态的数据包级负载均衡器。
源代码pub fn reset_key(&mut self, key: Arc<dyn HmacKey>) -> &mut EndpointConfig
pub fn reset_key(&mut self, key: Arc<dyn HmacKey>) -> &mut EndpointConfig
用于向与本端点上一实例通信的对端发送已认证的连接重置所用的私钥。
源代码pub fn max_udp_payload_size(
&mut self,
value: u16,
) -> Result<&mut EndpointConfig, ConfigError>
pub fn max_udp_payload_size( &mut self, value: u16, ) -> Result<&mut EndpointConfig, ConfigError>
接受来自对端的最大 UDP 有效负载大小(不含 UDP 与 IP 头部开销)。
必须大于或等于 1200。
默认为 1472,这是可在典型 1500 字节以太网 MTU 中传输的最大 UDP 有效负载。在具有更大 MTU 的链路上(例如回环或使用巨型帧的以太网),可以增大该值以提升性能,代价是数据报接收缓冲区大小线性增长。
源代码pub fn get_max_udp_payload_size(&self) -> u64
pub fn get_max_udp_payload_size(&self) -> u64
获取 max_udp_payload_size 的当前值
源代码pub fn supported_versions(
&mut self,
supported_versions: Vec<u32>,
) -> &mut EndpointConfig
pub fn supported_versions( &mut self, supported_versions: Vec<u32>, ) -> &mut EndpointConfig
覆盖所支持的 QUIC 版本
源代码pub fn grease_quic_bit(&mut self, value: bool) -> &mut EndpointConfig
pub fn grease_quic_bit(&mut self, value: bool) -> &mut EndpointConfig
是否接受 QUIC 包头中 fixed bit 为任意取值的包
默认开启。有助于防止协议僵化,并降低流量对观察者的可识别度。若希望让观察者能够将本流量识别为 QUIC,可关闭该选项。
源代码pub fn min_reset_interval(&mut self, value: Duration) -> &mut EndpointConfig
pub fn min_reset_interval(&mut self, value: Duration) -> &mut EndpointConfig
两条外发无状态重置包之间的最小间隔
默认为 20ms。用于限制向端点发送垃圾包的攻击(例如 ISAKMP/IKE amplification)所造成的影响。较大的值能提供更强的防御,但可能延迟客户端对某些错误情况的检测。使用在 validate 中具有较低误报率的 ConnectionIdGenerator,可以降低使用较小最小重置间隔所带来的风险。
trait 实现§
源代码§impl Clone for EndpointConfig
impl Clone for EndpointConfig
源代码§fn clone(&self) -> EndpointConfig
fn clone(&self) -> EndpointConfig
返回值的副本。 更多信息
1.0.0 · 源代码§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. 更多信息源代码§impl Debug for EndpointConfig
impl Debug for EndpointConfig
源代码§impl Default for EndpointConfig
Available on crate features aws-lc-rs or ring only.
impl Default for EndpointConfig
Available on crate features
aws-lc-rs or ring only.源代码§fn default() -> EndpointConfig
fn default() -> EndpointConfig
Returns the “default value” for a type. 更多信息
自动 trait 实现§
impl Freeze for EndpointConfig
impl !RefUnwindSafe for EndpointConfig
impl Send for EndpointConfig
impl Sync for EndpointConfig
impl Unpin for EndpointConfig
impl UnsafeUnpin for EndpointConfig
impl !UnwindSafe for EndpointConfig
blanket 实现§
源代码§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
源代码§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. 更多信息