Class InsecureQuicTokenHandler
java.lang.Object
io.netty.handler.codec.quic.InsecureQuicTokenHandler
- All Implemented Interfaces:
QuicTokenHandler
Insecure
QuicTokenHandler which only does basic token generation / validation without any
crypto.
This shouldn't be used in production.-
Nested Class Summary
Nested classes/interfaces inherited from interface QuicTokenHandler
QuicTokenHandler.TokenValidationResultModifier and TypeInterfaceDescriptionstatic final classThe result of a token validation. -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionintReturn the maximal token length.intvalidateToken(ByteBuf token, InetSocketAddress address) Validate the token and return the offset,-1is returned if the token is not valid.booleanwriteToken(ByteBuf out, ByteBuf dcid, InetSocketAddress address) Generate a new token for the given destination connection id and address.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface QuicTokenHandler
validateTokenModifier and TypeMethodDescriptionvalidateToken(ByteBuf token, InetSocketAddress address, ByteBuf dcid) Validate the token and return a structured result that determines how the ODCID should be derived.
-
Field Details
-
INSTANCE
-
-
Method Details
-
writeToken
Description copied from interface:QuicTokenHandlerGenerate a new token for the given destination connection id and address. This token is written toout. If no token should be generated and so no token validation should take place at all this method should returnfalse.- Specified by:
writeTokenin interfaceQuicTokenHandler- Parameters:
out-ByteBufinto which the token will be written.dcid- the destination connection id. TheByteBuf.readableBytes()will be at mostQuic.MAX_CONN_ID_LEN.address- theInetSocketAddressof the sender.- Returns:
trueif a token was written and so validation should happen,falseotherwise.
-
validateToken
Description copied from interface:QuicTokenHandlerValidate the token and return the offset,-1is returned if the token is not valid. The returned offset identifies where the ODCID starts in the token. Implementations that support tokens from NEW_TOKEN frames should overrideQuicTokenHandler.validateToken(ByteBuf, InetSocketAddress, ByteBuf).- Specified by:
validateTokenin interfaceQuicTokenHandler- Parameters:
token- theByteBufthat contains the token. The caller retains ownership of the buffer: implementations must not release it and must retain, duplicate or copy it before using it after this method returns.address- theInetSocketAddressof the sender.- Returns:
- the start index after the token or
-1if the token was not valid.
-
maxTokenLength
public int maxTokenLength()Description copied from interface:QuicTokenHandlerReturn the maximal token length.- Specified by:
maxTokenLengthin interfaceQuicTokenHandler- Returns:
- the maximal supported token length.
-