Class TcpServerConfig

java.lang.Object
io.servicetalk.tcp.netty.internal.TcpServerConfig

public final class TcpServerConfig extends Object
Configuration for TCP based servers.
  • Constructor Details

    • TcpServerConfig

      public TcpServerConfig()
    • TcpServerConfig

      public TcpServerConfig(TcpServerConfig from)
  • Method Details

    • sniConfig

      @Nullable public Map<String,ServerSslConfig> sniConfig()
    • sniMaxClientHelloLength

      public int sniMaxClientHelloLength()
    • sniClientHelloTimeout

      public Duration sniClientHelloTimeout()
    • acceptInsecureConnections

      public boolean acceptInsecureConnections()
    • sslConfig

      @Nullable public ServerSslConfig sslConfig()
      Returns:
      the ServerSslConfig, or null if SSL/TLS is not configured.
    • transportObserver

      public void transportObserver(TransportObserver transportObserver)
      Sets a TransportObserver that provides visibility into transport events.
      Parameters:
      transportObserver - A TransportObserver that provides visibility into transport events.
    • sslConfig

      public TcpServerConfig sslConfig(@Nullable ServerSslConfig sslConfig)
      Add SSL/TLS related config.
      Parameters:
      sslConfig - the ServerSslConfig.
      Returns:
      this.
    • sslConfig

      public TcpServerConfig sslConfig(@Nullable ServerSslConfig config, boolean acceptInsecureConnections)
      Set the SSL/TLS configuration and allows to specify if insecure connections should also be allowed.
      Parameters:
      config - The configuration to use.
      acceptInsecureConnections - if non-TLS connections are accepted on the same socket.
      Returns:
      this.
    • sslConfig

      public TcpServerConfig sslConfig(@Nullable ServerSslConfig defaultSslConfig, @Nullable Map<String,ServerSslConfig> sniConfig)
      Add SSL/TLS and SNI related config with default client hello settings.
      Parameters:
      defaultSslConfig - the default ServerSslConfig used when no SNI match is found.
      sniConfig - client SNI hostname values are matched against keys in this Map and if a match is found the corresponding ServerSslConfig is used.
      Returns:
      this
    • sslConfig

      public TcpServerConfig sslConfig(@Nullable ServerSslConfig defaultSslConfig, @Nullable Map<String,ServerSslConfig> sniConfig, int maxClientHelloLength, Duration clientHelloTimeout)
      Add SSL/TLS and SNI related config with custom client hello settings.
      Parameters:
      defaultSslConfig - the default ServerSslConfig used when no SNI match is found.
      sniConfig - client SNI hostname values are matched against keys in this Map and if a match is found the corresponding ServerSslConfig is used.
      maxClientHelloLength - the maximum length of a ClientHello message in bytes, up to 2^24 - 1 bytes. Zero (0) disables validation.
      clientHelloTimeout - The timeout for waiting until ClientHello message is received. Implementations can round the specified Duration to full time units, depending on their time granularity. Zero (0) disables timeout.
      Returns:
      this
    • sslConfig

      public TcpServerConfig sslConfig(@Nullable ServerSslConfig defaultSslConfig, @Nullable Map<String,ServerSslConfig> sniConfig, int maxClientHelloLength, Duration clientHelloTimeout, boolean acceptInsecureConnections)
      Add SSL/TLS and SNI related config with custom client hello and insecure connection settings.
      Parameters:
      defaultSslConfig - the default ServerSslConfig used when no SNI match is found.
      sniConfig - client SNI hostname values are matched against keys in this Map and if a match is found the corresponding ServerSslConfig is used.
      maxClientHelloLength - the maximum length of a ClientHello message in bytes, up to 2^24 - 1 bytes. Zero (0) disables validation.
      clientHelloTimeout - The timeout for waiting until ClientHello message is received. Implementations can round the specified Duration to full time units, depending on their time granularity.
      acceptInsecureConnections - if non-TLS connections are accepted on the same socket. Zero (0) disables timeout.
      Returns:
      this
    • listenSocketOption

      public <T> void listenSocketOption(SocketOption<T> option, T value)
      Adds a SocketOption that is applied to the server socket channel which listens/accepts socket channels.
      Type Parameters:
      T - the type of the value
      Parameters:
      option - the option to apply
      value - the value
      Throws:
      IllegalArgumentException - if the SocketOption is not supported
      See Also:
    • asReadOnly

      public ReadOnlyTcpServerConfig asReadOnly()
      Create a read only view of this object.
      Returns:
      a read only view of this object.
    • socketOption

      public final <T> void socketOption(SocketOption<T> option, T value)
      Add a SocketOption that is applied.
      Type Parameters:
      T - the type of the value
      Parameters:
      option - the option to apply
      value - the value
      Throws:
      IllegalArgumentException - if the SocketOption is not supported
      See Also:
    • flushStrategy

      public final void flushStrategy(FlushStrategy flushStrategy)
      Sets FlushStrategy to use for all connections.
      Parameters:
      flushStrategy - FlushStrategy to use for all connections
    • enableWireLogging

      public final void enableWireLogging(String loggerName, LogLevel logLevel, BooleanSupplier logUserData)
      Enable wire-logging for all connections.
      Parameters:
      loggerName - provides the logger to log data/events to/from the wire.
      logLevel - the level to log data/events to/from the wire.
      logUserData - true to include user data (e.g. data, headers, etc.). false to exclude user data and log only network events. This method is invoked for each data object allowing for dynamic behavior.