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
    • build

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