Interface QuicConnectionIdGenerator
public interface QuicConnectionIdGenerator
Creates new connection id instances.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if the implementation is idempotent, which means we will get the same id with the same input ByteBuffer.intReturns the maximum length of a connection id.newId(int length) Creates a new connection id with the given length.newId(ByteBuffer input, int length) Creates a new connection id with the given length.default ByteBuffernewId(ByteBuffer scid, ByteBuffer dcid, int length) Creates a new connection id with the given length.static QuicConnectionIdGeneratorReturn aQuicConnectionIdGeneratorwhich randomly generates new connection ids.static QuicConnectionIdGeneratorReturn aQuicConnectionIdGeneratorwhich generates new connection ids by signing the given input.
-
Method Details
-
newId
Creates a new connection id with the given length. This method may not be supported by a sign id generator implementation as a sign id generator should always have an input to sign with, otherwise this method may generate the same id which may cause some unpredictable issues when we use it.- Parameters:
length- the length of the id.- Returns:
- the id.
-
newId
Creates a new connection id with the given length. The given input may be used to sign or seed the id, or may be ignored (depending on the implementation).- Parameters:
input- the input which may be used to generate the id.length- the length of the id.- Returns:
- the id.
-
newId
Creates a new connection id with the given length. The given source connection id and destionation connection id may be used to sign or seed the id, or may be ignored (depending on the implementation).- Parameters:
scid- the source connection id which may be used to generate the id.dcid- the destination connection id which may be used to generate the id.length- the length of the id.- Returns:
- the id.
-
maxConnectionIdLength
int maxConnectionIdLength()Returns the maximum length of a connection id.- Returns:
- the maximum length of a connection id that is supported.
-
isIdempotent
boolean isIdempotent()Returns true if the implementation is idempotent, which means we will get the same id with the same input ByteBuffer. Otherwise, returns false.- Returns:
- whether the implementation is idempotent.
-
randomGenerator
Return aQuicConnectionIdGeneratorwhich randomly generates new connection ids.- Returns:
- a
QuicConnectionIdGeneratorwhich randomly generated ids.
-
signGenerator
Return aQuicConnectionIdGeneratorwhich generates new connection ids by signing the given input.- Returns:
- a
QuicConnectionIdGeneratorwhich generates ids by signing the given input.
-