Class ServerConfig

java.lang.Object
io.github.mahmoudimus.quic.connection.ServerConfig

public final class ServerConfig extends Object
How a server accepts connections: its TLS configuration (certificates, possibly selected per SNI, ALPN, session tickets and 0-RTT), the transport settings, Retry-based address validation, the NEW_TOKEN tokens that let returning clients skip the Retry, the connection cap, whether clients may migrate, and a preferred address. Immutable and shareable.
  • Method Details

    • migration

      public boolean migration()
      Whether clients may migrate to new addresses (RFC 9000 section 9).
      Returns:
      false if the server sends disable_active_migration and drops packets from new addresses
    • preferredIpv4

      public InetSocketAddress preferredIpv4()
      The IPv4 preferred address (RFC 9000 section 9.6).
      Returns:
      the address, or null
    • preferredIpv6

      public InetSocketAddress preferredIpv6()
      The IPv6 preferred address (RFC 9000 section 9.6).
      Returns:
      the address, or null
    • toBuilder

      public ServerConfig.Builder toBuilder()
      A builder that starts from this configuration, with the same token key.
      Returns:
      a new builder
    • newTokens

      public int newTokens()
      How many NEW_TOKEN tokens a connection sends the client after its handshake.
      Returns:
      the count
    • builder

      public static ServerConfig.Builder builder(TlsConfig tls)
      A builder.
      Parameters:
      tls - the TLS configuration, with a certificate or certificate selector and ALPN
      Returns:
      a new builder
    • tls

      public TlsConfig tls()
      The TLS configuration.
      Returns:
      the configuration
    • transport

      public TransportConfig transport()
      The transport settings of accepted connections.
      Returns:
      the settings
    • retry

      public boolean retry()
      Whether clients must prove their address with a Retry round trip before a connection is created (RFC 9000 section 8.1.2).
      Returns:
      true if Retry is on
    • maxConnections

      public int maxConnections()
      The most connections the endpoint holds at once; further connection attempts are refused.
      Returns:
      the cap