Package io.netty.handler.codec.quic
Interface QuicConnectionIdGenerator
-
public interface QuicConnectionIdGenerator
Creates new connection id instances.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
isIdempotent()
Returns true if the implementation is idempotent, which means we will get the same id with the same input ByteBuffer.int
maxConnectionIdLength()
Returns the maximum length of a connection id.java.nio.ByteBuffer
newId(int length)
Creates a new connection id with the given length.java.nio.ByteBuffer
newId(java.nio.ByteBuffer input, int length)
Creates a new connection id with the given length.default java.nio.ByteBuffer
newId(java.nio.ByteBuffer scid, java.nio.ByteBuffer dcid, int length)
Creates a new connection id with the given length.static QuicConnectionIdGenerator
randomGenerator()
Return aQuicConnectionIdGenerator
which randomly generates new connection ids.static QuicConnectionIdGenerator
signGenerator()
Return aQuicConnectionIdGenerator
which generates new connection ids by signing the given input.
-
-
-
Method Detail
-
newId
java.nio.ByteBuffer newId(int length)
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
java.nio.ByteBuffer newId(java.nio.ByteBuffer input, int length)
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
default java.nio.ByteBuffer newId(java.nio.ByteBuffer scid, java.nio.ByteBuffer dcid, int length)
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
static QuicConnectionIdGenerator randomGenerator()
Return aQuicConnectionIdGenerator
which randomly generates new connection ids.- Returns:
- a
QuicConnectionIdGenerator
which randomly generated ids.
-
signGenerator
static QuicConnectionIdGenerator signGenerator()
Return aQuicConnectionIdGenerator
which generates new connection ids by signing the given input.- Returns:
- a
QuicConnectionIdGenerator
which generates ids by signing the given input.
-
-