pub trait ConnectionIdGenerator<'a>: Send + 'static {
// Required methods
fn new_connection_id(&self, socket_cookie: u64) -> ConnectionId<'a>;
fn verify_connection_id(
&self,
socket_cookie: u64,
cid: &ConnectionId<'_>,
) -> QuicResult<()>;
}Expand description
A customizable generator to derive and verify QUIC connection IDs.
For QUIC servers, it can be useful to encode additional information in the
source connection ID. This trait allows users to implement their own logic
for that purpose. The crate also provides SimpleConnectionIdGenerator
if no such customization is needed.
Clients currently can’t configure a ConnectionIdGenerator and always use
the SimpleConnectionIdGenerator.
Required Methods§
Sourcefn new_connection_id(&self, socket_cookie: u64) -> ConnectionId<'a>
fn new_connection_id(&self, socket_cookie: u64) -> ConnectionId<'a>
Creates a new ConnectionId according to the generator’s logic.
The socket_cookie is propagated unchanged from the
QuicListener that received the
connection.
Sourcefn verify_connection_id(
&self,
socket_cookie: u64,
cid: &ConnectionId<'_>,
) -> QuicResult<()>
fn verify_connection_id( &self, socket_cookie: u64, cid: &ConnectionId<'_>, ) -> QuicResult<()>
Verifies whether cid was generated by this ConnectionIdGenerator.
socket_cookie matches the value that would have been passed to
new_connection_id calls. The method should return an Err variant
if the connection ID can’t be verified.