Class TCPSSLOptions
java.lang.Object
io.vertx.core.net.NetworkOptions
io.vertx.core.net.TCPSSLOptions
- Direct Known Subclasses:
ClientOptionsBase, EventBusOptions, NetServerOptions
Base class. TCP and SSL related options
- Author:
- Tim Fox
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault idle timeout = 0static final TimeUnitDefault idle time unit = SECONDSstatic final intDefault read idle timeout = 0static final intThe default value of SO_linger = -1static final booleanSSL enable by default = falsestatic final SSLEngineOptionsThe default SSL engine options = null (autoguess)static final booleanThe default TCP_CORK value = falsestatic final booleanThe default TCP_FASTOPEN value = falsestatic final intDefault value for tcp keepalive count.static final intDefault value for tcp keepalive idle time.static final intDefault value for tcp keepalive interval.static final booleanThe default value of TCP keep alive = falsestatic final booleanThe default value of TCP-no-delay = true (Nagle disabled)static final booleanThe default TCP_QUICKACK value = falsestatic final intThe default TCP_USER_TIMEOUT value in milliseconds = 0static final intDefault write idle timeout = 0 -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorTCPSSLOptions(JsonObject json) Create options from JSONTCPSSLOptions(TCPSSLOptions other) Copy constructor -
Method Summary
Modifier and TypeMethodDescriptionaddCrlPath(String crlPath) Add a CRL pathaddCrlValue(Buffer crlValue) Add a CRL valueaddEnabledCipherSuite(String suite) Add an enabled cipher suite, appended to the ordered suites.addEnabledSecureTransportProtocol(String protocol) Add an enabled SSL/TLS protocols, appended to the ordered protocols.protected SSLOptionsGet the CRL valuesReturn an ordered set of the cipher suites.Returns the enabled SSL/TLS protocolsintprotected SSLOptionsintintReturn the TCP receive buffer size, in bytesintReturn the TCP send buffer size, in bytes.intlongintintintintintintbooleanbooleanbooleanisSsl()booleanbooleanbooleanbooleanbooleanbooleanremoveEnabledCipherSuite(String suite) Removes an enabled cipher suite from the ordered suites.removeEnabledSecureTransportProtocol(String protocol) Removes an enabled SSL/TLS protocol from the ordered protocols.setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols) Sets the list of enabled SSL/TLS protocols.setIdleTimeout(int idleTimeout) Set the idle timeout, default time unit is seconds.setIdleTimeoutUnit(TimeUnit idleTimeoutUnit) Set the idle timeout unit.setKeyCertOptions(KeyCertOptions options) Set the key/cert options.setLogActivity(boolean logEnabled) Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.setReadIdleTimeout(int idleTimeout) Set the read idle timeout, default time unit is seconds.setReceiveBufferSize(int receiveBufferSize) Set the TCP receive buffer sizesetReuseAddress(boolean reuseAddress) Set the value of reuse addresssetReusePort(boolean reusePort) Set the value of reuse port.setSendBufferSize(int sendBufferSize) Set the TCP send buffer sizesetSoLinger(int soLinger) Set whether SO_linger keep alive is enabledsetSsl(boolean ssl) Set whether SSL/TLS is enabledsetSslEngineOptions(SSLEngineOptions sslEngineOptions) Set to use SSL engine implementation to use.setSslHandshakeTimeout(long sslHandshakeTimeout) Set the SSL handshake timeout, default time unit is seconds.setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit) Set the SSL handshake timeout unit.setTcpCork(boolean tcpCork) Enable theTCP_CORKoption - only with linux native transport.setTcpFastOpen(boolean tcpFastOpen) Enable theTCP_FASTOPENoption - only with linux native transport.setTcpKeepAlive(boolean tcpKeepAlive) Set whether TCP keep alive is enabledsetTcpKeepAliveCount(int tcpKeepAliveCount) The maximum number of keepalive probes TCP should send before dropping the connection.setTcpKeepAliveIdleSeconds(int tcpKeepAliveIdleSeconds) The time in seconds the connection needs to remain idle before TCP starts sending keepalive probes, if the socket option keepalive has been set.setTcpKeepAliveIntervalSeconds(int tcpKeepAliveIntervalSeconds) The time in seconds between individual keepalive probes (while the channel is idle).setTcpNoDelay(boolean tcpNoDelay) Set whether TCP no delay is enabledsetTcpQuickAck(boolean tcpQuickAck) Enable theTCP_QUICKACKoption - only with linux native transport.setTcpUserTimeout(int tcpUserTimeout) Sets theTCP_USER_TIMEOUToption - only with linux native transport.setTrafficClass(int trafficClass) Set the value of traffic classsetTrustOptions(TrustOptions options) Set the trust options.setUseAlpn(boolean useAlpn) Set the ALPN usage.setWriteIdleTimeout(int idleTimeout) Set the write idle timeout, default time unit is seconds.toJson()Convert to JSONMethods inherited from class NetworkOptions
getActivityLogDataFormat, getLogActivity, setActivityLogDataFormat
-
Field Details
-
DEFAULT_TCP_NO_DELAY
public static final boolean DEFAULT_TCP_NO_DELAYThe default value of TCP-no-delay = true (Nagle disabled)- See Also:
-
DEFAULT_TCP_KEEP_ALIVE
public static final boolean DEFAULT_TCP_KEEP_ALIVEThe default value of TCP keep alive = false- See Also:
-
DEFAULT_SO_LINGER
public static final int DEFAULT_SO_LINGERThe default value of SO_linger = -1- See Also:
-
DEFAULT_SSL
public static final boolean DEFAULT_SSLSSL enable by default = false- See Also:
-
DEFAULT_IDLE_TIMEOUT
public static final int DEFAULT_IDLE_TIMEOUTDefault idle timeout = 0- See Also:
-
DEFAULT_IDLE_TIMEOUT_TIME_UNIT
Default idle time unit = SECONDS -
DEFAULT_READ_IDLE_TIMEOUT
public static final int DEFAULT_READ_IDLE_TIMEOUTDefault read idle timeout = 0- See Also:
-
DEFAULT_WRITE_IDLE_TIMEOUT
public static final int DEFAULT_WRITE_IDLE_TIMEOUTDefault write idle timeout = 0- See Also:
-
DEFAULT_SSL_ENGINE
The default SSL engine options = null (autoguess) -
DEFAULT_TCP_FAST_OPEN
public static final boolean DEFAULT_TCP_FAST_OPENThe default TCP_FASTOPEN value = false- See Also:
-
DEFAULT_TCP_CORK
public static final boolean DEFAULT_TCP_CORKThe default TCP_CORK value = false- See Also:
-
DEFAULT_TCP_QUICKACK
public static final boolean DEFAULT_TCP_QUICKACKThe default TCP_QUICKACK value = false- See Also:
-
DEFAULT_TCP_USER_TIMEOUT
public static final int DEFAULT_TCP_USER_TIMEOUTThe default TCP_USER_TIMEOUT value in milliseconds = 0 When the default value of 0 is used, TCP will use the system default.- See Also:
-
DEFAULT_TCP_KEEAPLIVE_IDLE_SECONDS
public static final int DEFAULT_TCP_KEEAPLIVE_IDLE_SECONDSDefault value for tcp keepalive idle time.A value of
0means: Do not set this socket option, which will result in an OS-specific default value.- See Also:
-
DEFAULT_TCP_KEEAPLIVE_COUNT
public static final int DEFAULT_TCP_KEEAPLIVE_COUNTDefault value for tcp keepalive count.A value of
0means: Do not set this socket option, which will result in an OS-specific default value.- See Also:
-
DEFAULT_TCP_KEEAPLIVE_INTERVAL_SECONDS
public static final int DEFAULT_TCP_KEEAPLIVE_INTERVAL_SECONDSDefault value for tcp keepalive interval.A value of
0means: Do not set this socket option, which will result in an OS-specific default value.- See Also:
-
-
Constructor Details
-
TCPSSLOptions
public TCPSSLOptions()Default constructor -
TCPSSLOptions
-
TCPSSLOptions
-
-
Method Details
-
toJson
Convert to JSON- Specified by:
toJsonin classNetworkOptions- Returns:
- the JSON
-
getOrCreateSSLOptions
-
createSSLOptions
-
getTransportOptions
-
getSslOptions
-
getSendBufferSize
public int getSendBufferSize()Description copied from class:NetworkOptionsReturn the TCP send buffer size, in bytes.- Specified by:
getSendBufferSizein classNetworkOptions- Returns:
- the send buffer size
-
setSendBufferSize
Description copied from class:NetworkOptionsSet the TCP send buffer size- Specified by:
setSendBufferSizein classNetworkOptions- Parameters:
sendBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
getReceiveBufferSize
public int getReceiveBufferSize()Description copied from class:NetworkOptionsReturn the TCP receive buffer size, in bytes- Specified by:
getReceiveBufferSizein classNetworkOptions- Returns:
- the receive buffer size
-
setReceiveBufferSize
Description copied from class:NetworkOptionsSet the TCP receive buffer size- Specified by:
setReceiveBufferSizein classNetworkOptions- Parameters:
receiveBufferSize- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
isReuseAddress
public boolean isReuseAddress()- Specified by:
isReuseAddressin classNetworkOptions- Returns:
- the value of reuse address
-
setReuseAddress
Description copied from class:NetworkOptionsSet the value of reuse address- Specified by:
setReuseAddressin classNetworkOptions- Parameters:
reuseAddress- the value of reuse address- Returns:
- a reference to this, so the API can be used fluently
-
getTrafficClass
public int getTrafficClass()- Specified by:
getTrafficClassin classNetworkOptions- Returns:
- the value of traffic class
-
setTrafficClass
Description copied from class:NetworkOptionsSet the value of traffic class- Specified by:
setTrafficClassin classNetworkOptions- Parameters:
trafficClass- the value of traffic class- Returns:
- a reference to this, so the API can be used fluently
-
isReusePort
public boolean isReusePort()- Specified by:
isReusePortin classNetworkOptions- Returns:
- the value of reuse address - only supported by native transports
-
setReusePort
Description copied from class:NetworkOptionsSet the value of reuse port. This is only supported by native transports.- Specified by:
setReusePortin classNetworkOptions- Parameters:
reusePort- the value of reuse port- Returns:
- a reference to this, so the API can be used fluently
-
isTcpNoDelay
public boolean isTcpNoDelay()- Returns:
- TCP no delay enabled ?
-
setTcpNoDelay
Set whether TCP no delay is enabled- Parameters:
tcpNoDelay- true if TCP no delay is enabled (Nagle disabled)- Returns:
- a reference to this, so the API can be used fluently
-
isTcpKeepAlive
public boolean isTcpKeepAlive()- Returns:
- is TCP keep alive enabled?
-
setTcpKeepAlive
Set whether TCP keep alive is enabled- Parameters:
tcpKeepAlive- true if TCP keep alive is enabled- Returns:
- a reference to this, so the API can be used fluently
-
getSoLinger
public int getSoLinger()- Returns:
- is SO_linger enabled
-
setSoLinger
Set whether SO_linger keep alive is enabled- Parameters:
soLinger- true if SO_linger is enabled- Returns:
- a reference to this, so the API can be used fluently
-
setIdleTimeout
Set the idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received nor sent within the timeout. If you want change default time unit, usesetIdleTimeoutUnit(TimeUnit)- Parameters:
idleTimeout- the timeout- Returns:
- a reference to this, so the API can be used fluently
-
getIdleTimeout
public int getIdleTimeout()- Returns:
- the idle timeout, in time unit specified by
getIdleTimeoutUnit().
-
setReadIdleTimeout
Set the read idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is received within the timeout. If you want change default time unit, usesetIdleTimeoutUnit(TimeUnit)- Parameters:
idleTimeout- the read timeout- Returns:
- a reference to this, so the API can be used fluently
-
getReadIdleTimeout
public int getReadIdleTimeout()- Returns:
- the read idle timeout, in time unit specified by
getIdleTimeoutUnit().
-
setWriteIdleTimeout
Set the write idle timeout, default time unit is seconds. Zero means don't timeout. This determines if a connection will timeout and be closed if no data is sent within the timeout. If you want change default time unit, usesetIdleTimeoutUnit(TimeUnit)- Parameters:
idleTimeout- the write timeout- Returns:
- a reference to this, so the API can be used fluently
-
getWriteIdleTimeout
public int getWriteIdleTimeout()- Returns:
- the write idle timeout, in time unit specified by
getIdleTimeoutUnit().
-
setIdleTimeoutUnit
Set the idle timeout unit. If not specified, default is seconds.- Parameters:
idleTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
getIdleTimeoutUnit
- Returns:
- the idle timeout unit.
-
isSsl
public boolean isSsl()- Returns:
- is SSL/TLS enabled?
-
setSsl
Set whether SSL/TLS is enabled- Parameters:
ssl- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
getKeyCertOptions
- Returns:
- the key/cert options
-
setKeyCertOptions
Set the key/cert options.- Parameters:
options- the key store options- Returns:
- a reference to this, so the API can be used fluently
-
getTrustOptions
- Returns:
- the trust options
-
setTrustOptions
Set the trust options.- Parameters:
options- the trust options- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledCipherSuite
Add an enabled cipher suite, appended to the ordered suites.- Parameters:
suite- the suite- Returns:
- a reference to this, so the API can be used fluently
- See Also:
-
removeEnabledCipherSuite
Removes an enabled cipher suite from the ordered suites.- Parameters:
suite- the suite- Returns:
- a reference to this, so the API can be used fluently
-
getEnabledCipherSuites
Return an ordered set of the cipher suites.The set is initially empty and suite should be added to this set in the desired order.
When suites are added and therefore the list is not empty, it takes precedence over the default suite defined by the
SSLEngineOptionsin use.- Returns:
- the enabled cipher suites
-
getCrlPaths
-
addCrlPath
Add a CRL path- Parameters:
crlPath- the path- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
getCrlValues
-
addCrlValue
Add a CRL value- Parameters:
crlValue- the value- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
isUseAlpn
public boolean isUseAlpn()- Returns:
- whether to use or not Application-Layer Protocol Negotiation
-
setUseAlpn
Set the ALPN usage.- Parameters:
useAlpn- true when Application-Layer Protocol Negotiation should be used
-
getSslEngineOptions
- Returns:
- the SSL engine implementation to use
-
setSslEngineOptions
Set to use SSL engine implementation to use.- Parameters:
sslEngineOptions- the ssl engine to use- Returns:
- a reference to this, so the API can be used fluently
-
setEnabledSecureTransportProtocols
public TCPSSLOptions setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols) Sets the list of enabled SSL/TLS protocols.- Parameters:
enabledSecureTransportProtocols- the SSL/TLS protocols to enable- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledSecureTransportProtocol
Add an enabled SSL/TLS protocols, appended to the ordered protocols.- Parameters:
protocol- the SSL/TLS protocol to enable- Returns:
- a reference to this, so the API can be used fluently
-
removeEnabledSecureTransportProtocol
Removes an enabled SSL/TLS protocol from the ordered protocols.- Parameters:
protocol- the SSL/TLS protocol to disable- Returns:
- a reference to this, so the API can be used fluently
-
isTcpFastOpen
public boolean isTcpFastOpen()- Returns:
- wether
TCP_FASTOPENoption is enabled
-
setTcpFastOpen
Enable theTCP_FASTOPENoption - only with linux native transport.- Parameters:
tcpFastOpen- the fast open value
-
isTcpCork
public boolean isTcpCork()- Returns:
- wether
TCP_CORKoption is enabled
-
setTcpCork
Enable theTCP_CORKoption - only with linux native transport.- Parameters:
tcpCork- the cork value
-
isTcpQuickAck
public boolean isTcpQuickAck()- Returns:
- wether
TCP_QUICKACKoption is enabled
-
setTcpQuickAck
Enable theTCP_QUICKACKoption - only with linux native transport.- Parameters:
tcpQuickAck- the quick ack value
-
getTcpUserTimeout
public int getTcpUserTimeout()- Returns:
- the
TCP_USER_TIMEOUTvalue
-
setTcpUserTimeout
Sets theTCP_USER_TIMEOUToption - only with linux native transport.- Parameters:
tcpUserTimeout- the tcp user timeout value
-
getTcpKeepAliveIdleSeconds
public int getTcpKeepAliveIdleSeconds()- Returns:
- the time in seconds the connection needs to remain idle before TCP starts sending keepalive probes
-
setTcpKeepAliveIdleSeconds
The time in seconds the connection needs to remain idle before TCP starts sending keepalive probes, if the socket option keepalive has been set.Only works with linux native support (EPoll, IoUring).
- Parameters:
tcpKeepAliveIdleSeconds- idle time in seconds- Returns:
- a reference to this, so the API can be used fluently
-
getTcpKeepAliveCount
public int getTcpKeepAliveCount()- Returns:
- the maximum number of keepalive probes TCP should send before dropping the connection.
-
setTcpKeepAliveCount
The maximum number of keepalive probes TCP should send before dropping the connection.Only works with linux native support (EPoll, IoUring).
- Parameters:
tcpKeepAliveCount- number of probes- Returns:
- a reference to this, so the API can be used fluently
-
getTcpKeepAliveIntervalSeconds
public int getTcpKeepAliveIntervalSeconds()- Returns:
- the time in seconds between individual keepalive probes (while the channel is idle).
-
setTcpKeepAliveIntervalSeconds
The time in seconds between individual keepalive probes (while the channel is idle).Only works with linux native support (EPoll, IoUring).
- Parameters:
tcpKeepAliveIntervalSeconds- interval in seconds- Returns:
- a reference to this, so the API can be used fluently
-
getEnabledSecureTransportProtocols
-
getSslHandshakeTimeout
public long getSslHandshakeTimeout()- Returns:
- the SSL handshake timeout, in time unit specified by
getSslHandshakeTimeoutUnit().
-
setSslHandshakeTimeout
Set the SSL handshake timeout, default time unit is seconds.- Parameters:
sslHandshakeTimeout- the SSL handshake timeout to set, in milliseconds- Returns:
- a reference to this, so the API can be used fluently
-
setSslHandshakeTimeoutUnit
Set the SSL handshake timeout unit. If not specified, default is seconds.- Parameters:
sslHandshakeTimeoutUnit- specify time unit.- Returns:
- a reference to this, so the API can be used fluently
-
getSslHandshakeTimeoutUnit
- Returns:
- the SSL handshake timeout unit.
-
setLogActivity
Description copied from class:NetworkOptionsSet to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setLogActivityin classNetworkOptions- Parameters:
logEnabled- true for logging the network activity- Returns:
- a reference to this, so the API can be used fluently
-