Package io.vertx.core.net
Class TCPSSLOptions
- java.lang.Object
-
- io.vertx.core.net.NetworkOptions
-
- io.vertx.core.net.TCPSSLOptions
-
- Direct Known Subclasses:
ClientOptionsBase
,EventBusOptions
,NetServerOptions
public abstract class TCPSSLOptions extends NetworkOptions
Base class. TCP and SSL related options- Author:
- Tim Fox
-
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_IDLE_TIMEOUT
Default idle timeout = 0static TimeUnit
DEFAULT_IDLE_TIMEOUT_TIME_UNIT
Default idle time unit = SECONDSstatic int
DEFAULT_READ_IDLE_TIMEOUT
Default read idle timeout = 0static int
DEFAULT_SO_LINGER
The default value of SO_linger = -1static boolean
DEFAULT_SSL
SSL enable by default = falsestatic SSLEngineOptions
DEFAULT_SSL_ENGINE
The default SSL engine options = null (autoguess)static boolean
DEFAULT_TCP_CORK
The default TCP_CORK value = falsestatic boolean
DEFAULT_TCP_FAST_OPEN
The default TCP_FASTOPEN value = falsestatic boolean
DEFAULT_TCP_KEEP_ALIVE
The default value of TCP keep alive = falsestatic boolean
DEFAULT_TCP_NO_DELAY
The default value of TCP-no-delay = true (Nagle disabled)static boolean
DEFAULT_TCP_QUICKACK
The default TCP_QUICKACK value = falsestatic int
DEFAULT_TCP_USER_TIMEOUT
The default TCP_USER_TIMEOUT value in milliseconds = 0static int
DEFAULT_WRITE_IDLE_TIMEOUT
Default write idle timeout = 0-
Fields inherited from class io.vertx.core.net.NetworkOptions
DEFAULT_LOG_ACTIVITY_FORMAT, DEFAULT_LOG_ENABLED, DEFAULT_RECEIVE_BUFFER_SIZE, DEFAULT_REUSE_ADDRESS, DEFAULT_REUSE_PORT, DEFAULT_SEND_BUFFER_SIZE, DEFAULT_TRAFFIC_CLASS
-
-
Constructor Summary
Constructors Constructor Description TCPSSLOptions()
Default constructorTCPSSLOptions(JsonObject json)
Create options from JSONTCPSSLOptions(TCPSSLOptions other)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TCPSSLOptions
addCrlPath(String crlPath)
Add a CRL pathTCPSSLOptions
addCrlValue(Buffer crlValue)
Add a CRL valueTCPSSLOptions
addEnabledCipherSuite(String suite)
Add an enabled cipher suite, appended to the ordered suites.TCPSSLOptions
addEnabledSecureTransportProtocol(String protocol)
Add an enabled SSL/TLS protocols, appended to the ordered protocols.List<String>
getCrlPaths()
List<Buffer>
getCrlValues()
Get the CRL valuesSet<String>
getEnabledCipherSuites()
Return an ordered set of the cipher suites.Set<String>
getEnabledSecureTransportProtocols()
Returns the enabled SSL/TLS protocolsint
getIdleTimeout()
TimeUnit
getIdleTimeoutUnit()
KeyCertOptions
getKeyCertOptions()
protected SSLOptions
getOrCreateSSLOptions()
int
getReadIdleTimeout()
int
getSoLinger()
SSLEngineOptions
getSslEngineOptions()
long
getSslHandshakeTimeout()
TimeUnit
getSslHandshakeTimeoutUnit()
SSLOptions
getSslOptions()
int
getTcpUserTimeout()
TrustOptions
getTrustOptions()
int
getWriteIdleTimeout()
boolean
isSsl()
boolean
isTcpCork()
boolean
isTcpFastOpen()
boolean
isTcpKeepAlive()
boolean
isTcpNoDelay()
boolean
isTcpQuickAck()
boolean
isUseAlpn()
TCPSSLOptions
removeEnabledCipherSuite(String suite)
Removes an enabled cipher suite from the ordered suites.TCPSSLOptions
removeEnabledSecureTransportProtocol(String protocol)
Removes an enabled SSL/TLS protocol from the ordered protocols.TCPSSLOptions
setActivityLogDataFormat(ByteBufFormat activityLogDataFormat)
Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.TCPSSLOptions
setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
Sets the list of enabled SSL/TLS protocols.TCPSSLOptions
setIdleTimeout(int idleTimeout)
Set the idle timeout, default time unit is seconds.TCPSSLOptions
setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Set the idle timeout unit.TCPSSLOptions
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.TCPSSLOptions
setLogActivity(boolean logEnabled)
Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.TCPSSLOptions
setReadIdleTimeout(int idleTimeout)
Set the read idle timeout, default time unit is seconds.TCPSSLOptions
setReceiveBufferSize(int receiveBufferSize)
Set the TCP receive buffer sizeTCPSSLOptions
setReuseAddress(boolean reuseAddress)
Set the value of reuse addressTCPSSLOptions
setReusePort(boolean reusePort)
Set the value of reuse port.TCPSSLOptions
setSendBufferSize(int sendBufferSize)
Set the TCP send buffer sizeTCPSSLOptions
setSoLinger(int soLinger)
Set whether SO_linger keep alive is enabledTCPSSLOptions
setSsl(boolean ssl)
Set whether SSL/TLS is enabledTCPSSLOptions
setSslEngineOptions(SSLEngineOptions sslEngineOptions)
Set to use SSL engine implementation to use.TCPSSLOptions
setSslHandshakeTimeout(long sslHandshakeTimeout)
Set the SSL handshake timeout, default time unit is seconds.TCPSSLOptions
setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
Set the SSL handshake timeout unit.TCPSSLOptions
setTcpCork(boolean tcpCork)
Enable theTCP_CORK
option - only with linux native transport.TCPSSLOptions
setTcpFastOpen(boolean tcpFastOpen)
Enable theTCP_FASTOPEN
option - only with linux native transport.TCPSSLOptions
setTcpKeepAlive(boolean tcpKeepAlive)
Set whether TCP keep alive is enabledTCPSSLOptions
setTcpNoDelay(boolean tcpNoDelay)
Set whether TCP no delay is enabledTCPSSLOptions
setTcpQuickAck(boolean tcpQuickAck)
Enable theTCP_QUICKACK
option - only with linux native transport.TCPSSLOptions
setTcpUserTimeout(int tcpUserTimeout)
Sets theTCP_USER_TIMEOUT
option - only with linux native transport.TCPSSLOptions
setTrafficClass(int trafficClass)
Set the value of traffic classTCPSSLOptions
setTrustOptions(TrustOptions options)
Set the trust options.TCPSSLOptions
setUseAlpn(boolean useAlpn)
Set the ALPN usage.TCPSSLOptions
setWriteIdleTimeout(int idleTimeout)
Set the write idle timeout, default time unit is seconds.JsonObject
toJson()
Convert to JSON-
Methods inherited from class io.vertx.core.net.NetworkOptions
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
-
-
-
-
Field Detail
-
DEFAULT_TCP_NO_DELAY
public static final boolean DEFAULT_TCP_NO_DELAY
The default value of TCP-no-delay = true (Nagle disabled)- See Also:
- Constant Field Values
-
DEFAULT_TCP_KEEP_ALIVE
public static final boolean DEFAULT_TCP_KEEP_ALIVE
The default value of TCP keep alive = false- See Also:
- Constant Field Values
-
DEFAULT_SO_LINGER
public static final int DEFAULT_SO_LINGER
The default value of SO_linger = -1- See Also:
- Constant Field Values
-
DEFAULT_SSL
public static final boolean DEFAULT_SSL
SSL enable by default = false- See Also:
- Constant Field Values
-
DEFAULT_IDLE_TIMEOUT
public static final int DEFAULT_IDLE_TIMEOUT
Default idle timeout = 0- See Also:
- Constant Field Values
-
DEFAULT_IDLE_TIMEOUT_TIME_UNIT
public static final TimeUnit DEFAULT_IDLE_TIMEOUT_TIME_UNIT
Default idle time unit = SECONDS
-
DEFAULT_READ_IDLE_TIMEOUT
public static final int DEFAULT_READ_IDLE_TIMEOUT
Default read idle timeout = 0- See Also:
- Constant Field Values
-
DEFAULT_WRITE_IDLE_TIMEOUT
public static final int DEFAULT_WRITE_IDLE_TIMEOUT
Default write idle timeout = 0- See Also:
- Constant Field Values
-
DEFAULT_SSL_ENGINE
public static final SSLEngineOptions DEFAULT_SSL_ENGINE
The default SSL engine options = null (autoguess)
-
DEFAULT_TCP_FAST_OPEN
public static final boolean DEFAULT_TCP_FAST_OPEN
The default TCP_FASTOPEN value = false- See Also:
- Constant Field Values
-
DEFAULT_TCP_CORK
public static final boolean DEFAULT_TCP_CORK
The default TCP_CORK value = false- See Also:
- Constant Field Values
-
DEFAULT_TCP_QUICKACK
public static final boolean DEFAULT_TCP_QUICKACK
The default TCP_QUICKACK value = false- See Also:
- Constant Field Values
-
DEFAULT_TCP_USER_TIMEOUT
public static final int DEFAULT_TCP_USER_TIMEOUT
The default TCP_USER_TIMEOUT value in milliseconds = 0 When the default value of 0 is used, TCP will use the system default.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
TCPSSLOptions
public TCPSSLOptions()
Default constructor
-
TCPSSLOptions
public TCPSSLOptions(TCPSSLOptions other)
Copy constructor- Parameters:
other
- the options to copy
-
TCPSSLOptions
public TCPSSLOptions(JsonObject json)
Create options from JSON- Parameters:
json
- the JSON
-
-
Method Detail
-
toJson
public JsonObject toJson()
Convert to JSON- Overrides:
toJson
in classNetworkOptions
- Returns:
- the JSON
-
getOrCreateSSLOptions
protected SSLOptions getOrCreateSSLOptions()
-
getSslOptions
public SSLOptions getSslOptions()
-
isTcpNoDelay
public boolean isTcpNoDelay()
- Returns:
- TCP no delay enabled ?
-
setTcpNoDelay
public TCPSSLOptions setTcpNoDelay(boolean tcpNoDelay)
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
public TCPSSLOptions setTcpKeepAlive(boolean tcpKeepAlive)
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
public TCPSSLOptions setSoLinger(int soLinger)
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
public TCPSSLOptions setIdleTimeout(int idleTimeout)
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
public TCPSSLOptions setReadIdleTimeout(int idleTimeout)
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
public TCPSSLOptions setWriteIdleTimeout(int idleTimeout)
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
public TCPSSLOptions setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
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
public TimeUnit getIdleTimeoutUnit()
- Returns:
- the idle timeout unit.
-
isSsl
public boolean isSsl()
- Returns:
- is SSL/TLS enabled?
-
setSsl
public TCPSSLOptions setSsl(boolean ssl)
Set whether SSL/TLS is enabled- Parameters:
ssl
- true if enabled- Returns:
- a reference to this, so the API can be used fluently
-
getKeyCertOptions
public KeyCertOptions getKeyCertOptions()
- Returns:
- the key/cert options
-
setKeyCertOptions
public TCPSSLOptions setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.- Parameters:
options
- the key store options- Returns:
- a reference to this, so the API can be used fluently
-
getTrustOptions
public TrustOptions getTrustOptions()
- Returns:
- the trust options
-
setTrustOptions
public TCPSSLOptions setTrustOptions(TrustOptions options)
Set the trust options.- Parameters:
options
- the trust options- Returns:
- a reference to this, so the API can be used fluently
-
addEnabledCipherSuite
public TCPSSLOptions addEnabledCipherSuite(String suite)
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:
getEnabledCipherSuites()
-
removeEnabledCipherSuite
public TCPSSLOptions removeEnabledCipherSuite(String suite)
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
public Set<String> 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
SSLEngineOptions
in use.- Returns:
- the enabled cipher suites
-
addCrlPath
public TCPSSLOptions addCrlPath(String crlPath) throws NullPointerException
Add a CRL path- Parameters:
crlPath
- the path- Returns:
- a reference to this, so the API can be used fluently
- Throws:
NullPointerException
-
addCrlValue
public TCPSSLOptions addCrlValue(Buffer crlValue) throws NullPointerException
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
public TCPSSLOptions setUseAlpn(boolean useAlpn)
Set the ALPN usage.- Parameters:
useAlpn
- true when Application-Layer Protocol Negotiation should be used
-
getSslEngineOptions
public SSLEngineOptions getSslEngineOptions()
- Returns:
- the SSL engine implementation to use
-
setSslEngineOptions
public TCPSSLOptions setSslEngineOptions(SSLEngineOptions sslEngineOptions)
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
public TCPSSLOptions addEnabledSecureTransportProtocol(String protocol)
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
public TCPSSLOptions removeEnabledSecureTransportProtocol(String protocol)
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_FASTOPEN
option is enabled
-
setTcpFastOpen
public TCPSSLOptions setTcpFastOpen(boolean tcpFastOpen)
Enable theTCP_FASTOPEN
option - only with linux native transport.- Parameters:
tcpFastOpen
- the fast open value
-
isTcpCork
public boolean isTcpCork()
- Returns:
- wether
TCP_CORK
option is enabled
-
setTcpCork
public TCPSSLOptions setTcpCork(boolean tcpCork)
Enable theTCP_CORK
option - only with linux native transport.- Parameters:
tcpCork
- the cork value
-
isTcpQuickAck
public boolean isTcpQuickAck()
- Returns:
- wether
TCP_QUICKACK
option is enabled
-
setTcpQuickAck
public TCPSSLOptions setTcpQuickAck(boolean tcpQuickAck)
Enable theTCP_QUICKACK
option - only with linux native transport.- Parameters:
tcpQuickAck
- the quick ack value
-
getTcpUserTimeout
public int getTcpUserTimeout()
- Returns:
- the
TCP_USER_TIMEOUT
value
-
setTcpUserTimeout
public TCPSSLOptions setTcpUserTimeout(int tcpUserTimeout)
Sets theTCP_USER_TIMEOUT
option - only with linux native transport.- Parameters:
tcpUserTimeout
- the tcp user timeout value
-
getEnabledSecureTransportProtocols
public Set<String> getEnabledSecureTransportProtocols()
Returns the enabled SSL/TLS protocols- Returns:
- the enabled protocols
-
getSslHandshakeTimeout
public long getSslHandshakeTimeout()
- Returns:
- the SSL handshake timeout, in time unit specified by
getSslHandshakeTimeoutUnit()
.
-
setSslHandshakeTimeout
public TCPSSLOptions setSslHandshakeTimeout(long sslHandshakeTimeout)
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
public TCPSSLOptions setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
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
public TimeUnit getSslHandshakeTimeoutUnit()
- Returns:
- the SSL handshake timeout unit.
-
setLogActivity
public TCPSSLOptions setLogActivity(boolean logEnabled)
Description copied from class:NetworkOptions
Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setLogActivity
in classNetworkOptions
- Parameters:
logEnabled
- true for logging the network activity- Returns:
- a reference to this, so the API can be used fluently
-
setActivityLogDataFormat
public TCPSSLOptions setActivityLogDataFormat(ByteBufFormat activityLogDataFormat)
Description copied from class:NetworkOptions
Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.- Overrides:
setActivityLogDataFormat
in classNetworkOptions
- Parameters:
activityLogDataFormat
- the format to use- Returns:
- a reference to this, so the API can be used fluently
-
setSendBufferSize
public TCPSSLOptions setSendBufferSize(int sendBufferSize)
Description copied from class:NetworkOptions
Set the TCP send buffer size- Overrides:
setSendBufferSize
in classNetworkOptions
- Parameters:
sendBufferSize
- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReceiveBufferSize
public TCPSSLOptions setReceiveBufferSize(int receiveBufferSize)
Description copied from class:NetworkOptions
Set the TCP receive buffer size- Overrides:
setReceiveBufferSize
in classNetworkOptions
- Parameters:
receiveBufferSize
- the buffers size, in bytes- Returns:
- a reference to this, so the API can be used fluently
-
setReuseAddress
public TCPSSLOptions setReuseAddress(boolean reuseAddress)
Description copied from class:NetworkOptions
Set the value of reuse address- Overrides:
setReuseAddress
in classNetworkOptions
- Parameters:
reuseAddress
- the value of reuse address- Returns:
- a reference to this, so the API can be used fluently
-
setTrafficClass
public TCPSSLOptions setTrafficClass(int trafficClass)
Description copied from class:NetworkOptions
Set the value of traffic class- Overrides:
setTrafficClass
in classNetworkOptions
- Parameters:
trafficClass
- the value of traffic class- Returns:
- a reference to this, so the API can be used fluently
-
setReusePort
public TCPSSLOptions setReusePort(boolean reusePort)
Description copied from class:NetworkOptions
Set the value of reuse port. This is only supported by native transports.- Overrides:
setReusePort
in classNetworkOptions
- Parameters:
reusePort
- the value of reuse port- Returns:
- a reference to this, so the API can be used fluently
-
-