Class ClientConfig.Builder

java.lang.Object
io.github.mahmoudimus.quic.connection.ClientConfig.Builder
Enclosing class:
ClientConfig

public static final class ClientConfig.Builder extends Object
Builds a ClientConfig. Not thread-safe.
  • Method Details

    • transport

      public ClientConfig.Builder transport(TransportConfig transport)
      The transport settings.
      Parameters:
      transport - the settings
      Returns:
      this builder
    • version

      public ClientConfig.Builder version(QuicVersion version)
      The QUIC version to use, version 1 by default.
      Parameters:
      version - the version
      Returns:
      this builder
    • initialDcidLength

      public ClientConfig.Builder initialDcidLength(int length)
      The length of the random Destination Connection ID of the first Initial.
      Parameters:
      length - 8 to 20 bytes (RFC 9000 section 7.2); 20 by default
      Returns:
      this builder
    • sessionCache

      public ClientConfig.Builder sessionCache(SessionCache cache)
      The cache of session tickets and NEW_TOKEN tokens: resumption, 0-RTT (with TlsConfig.Builder.earlyData(boolean)) and Retry-free reconnection. SessionCache.none() turns them off.
      Parameters:
      cache - the cache, or null for the caller's default
      Returns:
      this builder
    • activeMigration

      public ClientConfig.Builder activeMigration(boolean activeMigration)
      Whether connections may migrate to a new local address (Connection.probePath(long, java.net.InetSocketAddress)), on by default. Off, the client sends disable_active_migration and refuses to migrate. A server that sent disable_active_migration is never migrated away from either way, except to its preferred address.
      Parameters:
      activeMigration - whether to allow active migration
      Returns:
      this builder
    • preferredAddress

      public ClientConfig.Builder preferredAddress(boolean preferredAddress)
      Whether to move to a server's preferred address (RFC 9000 section 9.6) once the handshake is confirmed, on by default: the client probes the address of its current path's family with the connection ID the server gave for it, and switches when the server answers.
      Parameters:
      preferredAddress - whether to follow a preferred address
      Returns:
      this builder
    • transportParameterProfile

      public ClientConfig.Builder transportParameterProfile(TransportParameterProfile profile)
      The transport parameters as a browser sends them (TransportParameterProfile.chrome156()): its parameters, in its order, with its GREASE; their values are still the connection's, so the transport configuration should match the browser's too. Default none: the client's own.
      Parameters:
      profile - the profile, or null for none
      Returns:
      this builder
    • initialPacketShape

      public ClientConfig.Builder initialPacketShape(InitialPacketShape shape)
      The shape of the client's Initial packets (InitialPacketShape.CHROME); default none: packet numbers from 0, Initial datagrams padded to 1200 bytes, frames in order.
      Parameters:
      shape - the shape, or null for none
      Returns:
      this builder
    • build

      public ClientConfig build()
      Builds the configuration.
      Returns:
      the configuration