Interface QuicConnectionIdGenerator


public interface QuicConnectionIdGenerator
Creates new connection id instances.
  • Method Details

    • newId

      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

      ByteBuffer newId(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 ByteBuffer newId(ByteBuffer scid, 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 a QuicConnectionIdGenerator which randomly generates new connection ids.
      Returns:
      a QuicConnectionIdGenerator which randomly generated ids.
    • signGenerator

      static QuicConnectionIdGenerator signGenerator()
      Return a QuicConnectionIdGenerator which generates new connection ids by signing the given input.
      Returns:
      a QuicConnectionIdGenerator which generates ids by signing the given input.