public class NetServerOptions extends TCPSSLOptions
NetServer
.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_ACCEPT_BACKLOG
The default accept backlog = 1024
|
static ClientAuth |
DEFAULT_CLIENT_AUTH
Default value of whether client auth is required (SSL/TLS) = No
|
static String |
DEFAULT_HOST
The default host to listen on = "0.0.0.0" (meaning listen on all available interfaces).
|
static int |
DEFAULT_PORT
The default port to listen on = 0 (meaning a random ephemeral free port will be chosen)
|
static long |
DEFAULT_PROXY_PROTOCOL_TIMEOUT
The default value of HA PROXY protocol timeout = 10
|
static TimeUnit |
DEFAULT_PROXY_PROTOCOL_TIMEOUT_TIME_UNIT
Default HA PROXY protocol time unit = SECONDS
|
static boolean |
DEFAULT_REGISTER_WRITE_HANDLER
Whether a write-handler should be registered by default = false.
|
static boolean |
DEFAULT_SNI
Default value of whether the server supports SNI = false
|
static boolean |
DEFAULT_USE_PROXY_PROTOCOL
Default value of whether the server supports HA PROXY protocol = false
|
DEFAULT_ENABLED_SECURE_TRANSPORT_PROTOCOLS, DEFAULT_IDLE_TIMEOUT, DEFAULT_IDLE_TIMEOUT_TIME_UNIT, DEFAULT_READ_IDLE_TIMEOUT, DEFAULT_SO_LINGER, DEFAULT_SSL, DEFAULT_SSL_ENGINE, DEFAULT_SSL_HANDSHAKE_TIMEOUT, DEFAULT_SSL_HANDSHAKE_TIMEOUT_TIME_UNIT, DEFAULT_TCP_CORK, DEFAULT_TCP_FAST_OPEN, DEFAULT_TCP_KEEP_ALIVE, DEFAULT_TCP_NO_DELAY, DEFAULT_TCP_QUICKACK, DEFAULT_TCP_USER_TIMEOUT, DEFAULT_USE_ALPN, DEFAULT_WRITE_IDLE_TIMEOUT
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 and Description |
---|
NetServerOptions()
Default constructor
|
NetServerOptions(JsonObject json)
Create some options from JSON
|
NetServerOptions(NetServerOptions other)
Copy constructor
|
Modifier and Type | Method and Description |
---|---|
NetServerOptions |
addCrlPath(String crlPath)
Add a CRL path
|
NetServerOptions |
addCrlValue(Buffer crlValue)
Add a CRL value
|
NetServerOptions |
addEnabledCipherSuite(String suite)
Add an enabled cipher suite, appended to the ordered suites.
|
NetServerOptions |
addEnabledSecureTransportProtocol(String protocol)
Add an enabled SSL/TLS protocols, appended to the ordered protocols.
|
int |
getAcceptBacklog() |
ClientAuth |
getClientAuth() |
String |
getHost() |
int |
getPort() |
long |
getProxyProtocolTimeout() |
TimeUnit |
getProxyProtocolTimeoutUnit() |
boolean |
isRegisterWriteHandler() |
boolean |
isSni() |
boolean |
isUseProxyProtocol() |
NetServerOptions |
removeEnabledCipherSuite(String suite)
Removes an enabled cipher suite from the ordered suites.
|
NetServerOptions |
removeEnabledSecureTransportProtocol(String protocol)
Removes an enabled SSL/TLS protocol from the ordered protocols.
|
NetServerOptions |
setAcceptBacklog(int acceptBacklog)
Set the accept back log
|
NetServerOptions |
setActivityLogDataFormat(io.netty.handler.logging.ByteBufFormat activityLogDataFormat)
Set the value of Netty's logging handler's data format: Netty's pipeline is configured for logging on Netty's logger.
|
NetServerOptions |
setClientAuth(ClientAuth clientAuth)
Set whether client auth is required
|
NetServerOptions |
setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
Sets the list of enabled SSL/TLS protocols.
|
NetServerOptions |
setHost(String host)
Set the host
|
NetServerOptions |
setIdleTimeout(int idleTimeout)
Set the idle timeout, default time unit is seconds.
|
NetServerOptions |
setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
Set the idle timeout unit.
|
NetServerOptions |
setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions) |
NetServerOptions |
setKeyCertOptions(KeyCertOptions options)
Set the key/cert options.
|
NetServerOptions |
setKeyStoreOptions(JksOptions options)
Set the key/cert options in jks format, aka Java keystore.
|
NetServerOptions |
setLogActivity(boolean logEnabled)
Set to true to enabled network activity logging: Netty's pipeline is configured for logging on Netty's logger.
|
NetServerOptions |
setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions) |
NetServerOptions |
setPemKeyCertOptions(PemKeyCertOptions options)
Set the key/cert store options in pem format.
|
NetServerOptions |
setPemTrustOptions(PemTrustOptions options)
Set the trust options in pem format
|
NetServerOptions |
setPfxKeyCertOptions(PfxOptions options)
Set the key/cert options in pfx format.
|
NetServerOptions |
setPfxTrustOptions(PfxOptions options)
Set the trust options in pfx format
|
NetServerOptions |
setPort(int port)
Set the port
|
NetServerOptions |
setProxyProtocolTimeout(long proxyProtocolTimeout)
Set the Proxy protocol timeout, default time unit is seconds.
|
NetServerOptions |
setProxyProtocolTimeoutUnit(TimeUnit proxyProtocolTimeoutUnit)
Set the Proxy protocol timeout unit.
|
NetServerOptions |
setReadIdleTimeout(int idleTimeout)
Set the read idle timeout, default time unit is seconds.
|
NetServerOptions |
setReceiveBufferSize(int receiveBufferSize)
Set the TCP receive buffer size
|
NetServerOptions |
setRegisterWriteHandler(boolean registerWriteHandler)
Whether a write-handler should be registered on the
EventBus . |
NetServerOptions |
setReuseAddress(boolean reuseAddress)
Set the value of reuse address
|
NetServerOptions |
setReusePort(boolean reusePort)
Set the value of reuse port.
|
NetServerOptions |
setSendBufferSize(int sendBufferSize)
Set the TCP send buffer size
|
NetServerOptions |
setSni(boolean sni)
Set whether the server supports Server Name Indiciation
|
NetServerOptions |
setSoLinger(int soLinger)
Set whether SO_linger keep alive is enabled
|
NetServerOptions |
setSsl(boolean ssl)
Set whether SSL/TLS is enabled
|
NetServerOptions |
setSslEngineOptions(SSLEngineOptions sslEngineOptions)
Set to use SSL engine implementation to use.
|
NetServerOptions |
setSslHandshakeTimeout(long sslHandshakeTimeout)
Set the SSL handshake timeout, default time unit is seconds.
|
NetServerOptions |
setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
Set the SSL handshake timeout unit.
|
NetServerOptions |
setTcpCork(boolean tcpCork)
Enable the
TCP_CORK option - only with linux native transport. |
NetServerOptions |
setTcpFastOpen(boolean tcpFastOpen)
Enable the
TCP_FASTOPEN option - only with linux native transport. |
NetServerOptions |
setTcpKeepAlive(boolean tcpKeepAlive)
Set whether TCP keep alive is enabled
|
NetServerOptions |
setTcpNoDelay(boolean tcpNoDelay)
Set whether TCP no delay is enabled
|
NetServerOptions |
setTcpQuickAck(boolean tcpQuickAck)
Enable the
TCP_QUICKACK option - only with linux native transport. |
NetServerOptions |
setTrafficClass(int trafficClass)
Set the value of traffic class
|
NetServerOptions |
setTrustOptions(TrustOptions options)
Set the trust options.
|
NetServerOptions |
setTrustStoreOptions(JksOptions options)
Set the trust options in jks format, aka Java truststore
|
NetServerOptions |
setUseAlpn(boolean useAlpn)
Set the ALPN usage.
|
NetServerOptions |
setUseProxyProtocol(boolean useProxyProtocol)
Set whether the server uses the HA Proxy protocol
|
NetServerOptions |
setWriteIdleTimeout(int idleTimeout)
Set the write idle timeout, default time unit is seconds.
|
JsonObject |
toJson()
Convert to JSON
|
getCrlPaths, getCrlValues, getEnabledCipherSuites, getEnabledSecureTransportProtocols, getIdleTimeout, getIdleTimeoutUnit, getJdkSslEngineOptions, getKeyCertOptions, getKeyStoreOptions, getOpenSslEngineOptions, getPemKeyCertOptions, getPemTrustOptions, getPfxKeyCertOptions, getPfxTrustOptions, getReadIdleTimeout, getSoLinger, getSslEngineOptions, getSslHandshakeTimeout, getSslHandshakeTimeoutUnit, getSslOptions, getTcpUserTimeout, getTrustOptions, getTrustStoreOptions, getWriteIdleTimeout, isSsl, isTcpCork, isTcpFastOpen, isTcpKeepAlive, isTcpNoDelay, isTcpQuickAck, isUseAlpn, setTcpUserTimeout
getActivityLogDataFormat, getLogActivity, getReceiveBufferSize, getSendBufferSize, getTrafficClass, isReuseAddress, isReusePort
public static final int DEFAULT_PORT
public static final String DEFAULT_HOST
public static final int DEFAULT_ACCEPT_BACKLOG
public static final ClientAuth DEFAULT_CLIENT_AUTH
public static final boolean DEFAULT_SNI
public static final boolean DEFAULT_USE_PROXY_PROTOCOL
public static final long DEFAULT_PROXY_PROTOCOL_TIMEOUT
public static final TimeUnit DEFAULT_PROXY_PROTOCOL_TIMEOUT_TIME_UNIT
public static final boolean DEFAULT_REGISTER_WRITE_HANDLER
public NetServerOptions()
public NetServerOptions(NetServerOptions other)
other
- the options to copypublic NetServerOptions(JsonObject json)
json
- the JSONpublic JsonObject toJson()
toJson
in class TCPSSLOptions
public NetServerOptions setSendBufferSize(int sendBufferSize)
NetworkOptions
setSendBufferSize
in class TCPSSLOptions
sendBufferSize
- the buffers size, in bytespublic NetServerOptions setReceiveBufferSize(int receiveBufferSize)
NetworkOptions
setReceiveBufferSize
in class TCPSSLOptions
receiveBufferSize
- the buffers size, in bytespublic NetServerOptions setReuseAddress(boolean reuseAddress)
NetworkOptions
setReuseAddress
in class TCPSSLOptions
reuseAddress
- the value of reuse addresspublic NetServerOptions setReusePort(boolean reusePort)
NetworkOptions
setReusePort
in class TCPSSLOptions
reusePort
- the value of reuse portpublic NetServerOptions setTrafficClass(int trafficClass)
NetworkOptions
setTrafficClass
in class TCPSSLOptions
trafficClass
- the value of traffic classpublic NetServerOptions setTcpNoDelay(boolean tcpNoDelay)
TCPSSLOptions
setTcpNoDelay
in class TCPSSLOptions
tcpNoDelay
- true if TCP no delay is enabled (Nagle disabled)public NetServerOptions setTcpKeepAlive(boolean tcpKeepAlive)
TCPSSLOptions
setTcpKeepAlive
in class TCPSSLOptions
tcpKeepAlive
- true if TCP keep alive is enabledpublic NetServerOptions setSoLinger(int soLinger)
TCPSSLOptions
setSoLinger
in class TCPSSLOptions
soLinger
- true if SO_linger is enabledpublic NetServerOptions setIdleTimeout(int idleTimeout)
TCPSSLOptions
TCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
setIdleTimeout
in class TCPSSLOptions
idleTimeout
- the timeoutpublic NetServerOptions setReadIdleTimeout(int idleTimeout)
TCPSSLOptions
TCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
setReadIdleTimeout
in class TCPSSLOptions
idleTimeout
- the read timeoutpublic NetServerOptions setWriteIdleTimeout(int idleTimeout)
TCPSSLOptions
TCPSSLOptions.setIdleTimeoutUnit(TimeUnit)
setWriteIdleTimeout
in class TCPSSLOptions
idleTimeout
- the write timeoutpublic NetServerOptions setIdleTimeoutUnit(TimeUnit idleTimeoutUnit)
TCPSSLOptions
setIdleTimeoutUnit
in class TCPSSLOptions
idleTimeoutUnit
- specify time unit.public NetServerOptions setSsl(boolean ssl)
TCPSSLOptions
setSsl
in class TCPSSLOptions
ssl
- true if enabledpublic NetServerOptions setUseAlpn(boolean useAlpn)
TCPSSLOptions
setUseAlpn
in class TCPSSLOptions
useAlpn
- true when Application-Layer Protocol Negotiation should be usedpublic NetServerOptions setSslEngineOptions(SSLEngineOptions sslEngineOptions)
TCPSSLOptions
setSslEngineOptions
in class TCPSSLOptions
sslEngineOptions
- the ssl engine to usepublic NetServerOptions setJdkSslEngineOptions(JdkSSLEngineOptions sslEngineOptions)
setJdkSslEngineOptions
in class TCPSSLOptions
public NetServerOptions setOpenSslEngineOptions(OpenSSLEngineOptions sslEngineOptions)
setOpenSslEngineOptions
in class TCPSSLOptions
public NetServerOptions setKeyCertOptions(KeyCertOptions options)
TCPSSLOptions
setKeyCertOptions
in class TCPSSLOptions
options
- the key store optionspublic NetServerOptions setKeyStoreOptions(JksOptions options)
TCPSSLOptions
setKeyStoreOptions
in class TCPSSLOptions
options
- the key store in jks formatpublic NetServerOptions setPfxKeyCertOptions(PfxOptions options)
TCPSSLOptions
setPfxKeyCertOptions
in class TCPSSLOptions
options
- the key cert options in pfx formatpublic NetServerOptions setPemKeyCertOptions(PemKeyCertOptions options)
TCPSSLOptions
setPemKeyCertOptions
in class TCPSSLOptions
options
- the options in pem formatpublic NetServerOptions setTrustOptions(TrustOptions options)
TCPSSLOptions
setTrustOptions
in class TCPSSLOptions
options
- the trust optionspublic NetServerOptions setTrustStoreOptions(JksOptions options)
TCPSSLOptions
setTrustStoreOptions
in class TCPSSLOptions
options
- the trust options in jks formatpublic NetServerOptions setPfxTrustOptions(PfxOptions options)
TCPSSLOptions
setPfxTrustOptions
in class TCPSSLOptions
options
- the trust options in pfx formatpublic NetServerOptions setPemTrustOptions(PemTrustOptions options)
TCPSSLOptions
setPemTrustOptions
in class TCPSSLOptions
options
- the trust options in pem formatpublic NetServerOptions addEnabledCipherSuite(String suite)
TCPSSLOptions
addEnabledCipherSuite
in class TCPSSLOptions
suite
- the suiteTCPSSLOptions.getEnabledCipherSuites()
public NetServerOptions removeEnabledCipherSuite(String suite)
TCPSSLOptions
removeEnabledCipherSuite
in class TCPSSLOptions
suite
- the suitepublic NetServerOptions addEnabledSecureTransportProtocol(String protocol)
TCPSSLOptions
addEnabledSecureTransportProtocol
in class TCPSSLOptions
protocol
- the SSL/TLS protocol to enablepublic NetServerOptions removeEnabledSecureTransportProtocol(String protocol)
TCPSSLOptions
removeEnabledSecureTransportProtocol
in class TCPSSLOptions
protocol
- the SSL/TLS protocol to disablepublic NetServerOptions setTcpFastOpen(boolean tcpFastOpen)
TCPSSLOptions
TCP_FASTOPEN
option - only with linux native transport.setTcpFastOpen
in class TCPSSLOptions
tcpFastOpen
- the fast open valuepublic NetServerOptions setTcpCork(boolean tcpCork)
TCPSSLOptions
TCP_CORK
option - only with linux native transport.setTcpCork
in class TCPSSLOptions
tcpCork
- the cork valuepublic NetServerOptions setTcpQuickAck(boolean tcpQuickAck)
TCPSSLOptions
TCP_QUICKACK
option - only with linux native transport.setTcpQuickAck
in class TCPSSLOptions
tcpQuickAck
- the quick ack valuepublic NetServerOptions addCrlPath(String crlPath) throws NullPointerException
TCPSSLOptions
addCrlPath
in class TCPSSLOptions
crlPath
- the pathNullPointerException
public NetServerOptions addCrlValue(Buffer crlValue) throws NullPointerException
TCPSSLOptions
addCrlValue
in class TCPSSLOptions
crlValue
- the valueNullPointerException
public NetServerOptions setEnabledSecureTransportProtocols(Set<String> enabledSecureTransportProtocols)
TCPSSLOptions
setEnabledSecureTransportProtocols
in class TCPSSLOptions
enabledSecureTransportProtocols
- the SSL/TLS protocols to enablepublic NetServerOptions setSslHandshakeTimeout(long sslHandshakeTimeout)
TCPSSLOptions
setSslHandshakeTimeout
in class TCPSSLOptions
sslHandshakeTimeout
- the SSL handshake timeout to set, in millisecondspublic NetServerOptions setSslHandshakeTimeoutUnit(TimeUnit sslHandshakeTimeoutUnit)
TCPSSLOptions
setSslHandshakeTimeoutUnit
in class TCPSSLOptions
sslHandshakeTimeoutUnit
- specify time unit.public int getAcceptBacklog()
public NetServerOptions setAcceptBacklog(int acceptBacklog)
acceptBacklog
- accept backlogpublic int getPort()
public NetServerOptions setPort(int port)
port
- the portpublic String getHost()
public NetServerOptions setHost(String host)
host
- the hostpublic ClientAuth getClientAuth()
public NetServerOptions setClientAuth(ClientAuth clientAuth)
clientAuth
- One of "NONE, REQUEST, REQUIRED". If it's set to "REQUIRED" then server will require the
SSL cert to be presented otherwise it won't accept the request. If it's set to "REQUEST" then
it won't mandate the certificate to be presented, basically make it optional.public NetServerOptions setLogActivity(boolean logEnabled)
NetworkOptions
setLogActivity
in class TCPSSLOptions
logEnabled
- true for logging the network activitypublic NetServerOptions setActivityLogDataFormat(io.netty.handler.logging.ByteBufFormat activityLogDataFormat)
NetworkOptions
setActivityLogDataFormat
in class TCPSSLOptions
activityLogDataFormat
- the format to usepublic boolean isSni()
public NetServerOptions setSni(boolean sni)
public boolean isUseProxyProtocol()
public NetServerOptions setUseProxyProtocol(boolean useProxyProtocol)
public long getProxyProtocolTimeout()
getProxyProtocolTimeoutUnit()
.public NetServerOptions setProxyProtocolTimeout(long proxyProtocolTimeout)
proxyProtocolTimeout
- the Proxy protocol timeout to setpublic NetServerOptions setProxyProtocolTimeoutUnit(TimeUnit proxyProtocolTimeoutUnit)
proxyProtocolTimeoutUnit
- specify time unit.public TimeUnit getProxyProtocolTimeoutUnit()
public boolean isRegisterWriteHandler()
true
if a write-handler should be registered on the EventBus
, otherwise false
public NetServerOptions setRegisterWriteHandler(boolean registerWriteHandler)
EventBus
.
Defaults to false
.
registerWriteHandler
- true to register a write-handlerNetSocket.writeHandlerID()
Copyright © 2023 Eclipse. All rights reserved.