Class TcpServerConfig
java.lang.Object
io.servicetalk.tcp.netty.internal.TcpServerConfig
Configuration for TCP based servers.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Create a read only view of this object.final void
enableWireLogging
(String loggerName, LogLevel logLevel, BooleanSupplier logUserData) Enable wire-logging for all connections.final void
flushStrategy
(FlushStrategy flushStrategy) SetsFlushStrategy
to use for all connections.<T> void
listenSocketOption
(SocketOption<T> option, T value) Adds aSocketOption
that is applied to the server socket channel which listens/accepts socket channels.int
final <T> void
socketOption
(SocketOption<T> option, T value) Add aSocketOption
that is applied.Get theServerSslConfig
.sslConfig
(ServerSslConfig sslConfig) Add SSL/TLS related config.sslConfig
(ServerSslConfig config, boolean acceptInsecureConnections) Set the SSL/TLS configuration and allows to specify if insecure connections should also be allowed.sslConfig
(ServerSslConfig defaultSslConfig, Map<String, ServerSslConfig> sniConfig) Add SSL/TLS and SNI related config with default client hello settings.sslConfig
(ServerSslConfig defaultSslConfig, Map<String, ServerSslConfig> sniConfig, int maxClientHelloLength, Duration clientHelloTimeout) Add SSL/TLS and SNI related config with custom client hello settings.sslConfig
(ServerSslConfig defaultSslConfig, 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.void
transportObserver
(TransportObserver transportObserver) Sets aTransportObserver
that provides visibility into transport events.
-
Constructor Details
-
TcpServerConfig
public TcpServerConfig() -
TcpServerConfig
-
-
Method Details
-
sniConfig
-
sniMaxClientHelloLength
public int sniMaxClientHelloLength() -
sniClientHelloTimeout
-
acceptInsecureConnections
public boolean acceptInsecureConnections() -
sslConfig
Get theServerSslConfig
.- Returns:
- the
ServerSslConfig
, ornull
if SSL/TLS is not configured.
-
transportObserver
Sets aTransportObserver
that provides visibility into transport events.- Parameters:
transportObserver
- ATransportObserver
that provides visibility into transport events.
-
sslConfig
Add SSL/TLS related config.- Parameters:
sslConfig
- theServerSslConfig
.- 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 defaultServerSslConfig
used when no SNI match is found.sniConfig
- client SNI hostname values are matched against keys in thisMap
and if a match is found the correspondingServerSslConfig
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 defaultServerSslConfig
used when no SNI match is found.sniConfig
- client SNI hostname values are matched against keys in thisMap
and if a match is found the correspondingServerSslConfig
is used.maxClientHelloLength
- the maximum length of a ClientHello message in bytes, up to2^24 - 1
bytes. Zero (0
) disables validation.clientHelloTimeout
- The timeout for waiting until ClientHello message is received. Implementations can round the specifiedDuration
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 defaultServerSslConfig
used when no SNI match is found.sniConfig
- client SNI hostname values are matched against keys in thisMap
and if a match is found the correspondingServerSslConfig
is used.maxClientHelloLength
- the maximum length of a ClientHello message in bytes, up to2^24 - 1
bytes. Zero (0
) disables validation.clientHelloTimeout
- The timeout for waiting until ClientHello message is received. Implementations can round the specifiedDuration
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
Adds aSocketOption
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 applyvalue
- the value- Throws:
IllegalArgumentException
- if theSocketOption
is not supported- See Also:
-
asReadOnly
Create a read only view of this object.- Returns:
- a read only view of this object.
-
socketOption
Add aSocketOption
that is applied.- Type Parameters:
T
- the type of the value- Parameters:
option
- the option to applyvalue
- the value- Throws:
IllegalArgumentException
- if theSocketOption
is not supported- See Also:
-
flushStrategy
SetsFlushStrategy
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.
-