public abstract class QuicServer extends Transport<T,CONF>
bind()
is ultimately called.
Example:
QuicServer.create()
.tokenHandler(InsecureQuicTokenHandler.INSTANCE)
.port(7777)
.wiretap(true)
.secure(serverCtx)
.idleTimeout(Duration.ofSeconds(5))
.initialSettings(spec ->
spec.maxData(10000000)
.maxStreamDataBidirectionalLocal(1000000)
.maxStreamDataBidirectionalRemote(1000000)
.maxStreamsBidirectional(100)
.maxStreamsUnidirectional(100))
.bindNow();
Constructor and Description |
---|
QuicServer() |
Modifier and Type | Method and Description |
---|---|
T |
ackDelayExponent(long ackDelayExponent)
Set the delay exponent used for ACKs.
|
T |
activeMigration(boolean enable)
Enable/disable active migration.
|
abstract Mono<? extends Connection> |
bind()
|
Connection |
bindNow()
Starts the server in a blocking fashion, and waits for it to finish initializing
or the startup timeout expires (the startup timeout is
45 seconds). |
Connection |
bindNow(Duration timeout)
Start the server in a blocking fashion, and wait for it to finish initializing
or the provided startup timeout expires.
|
T |
congestionControlAlgorithm(io.netty.incubator.codec.quic.QuicCongestionControlAlgorithm congestionControlAlgorithm)
Set the congestion control algorithm to use.
|
QuicServer |
connectionIdAddressGenerator(io.netty.incubator.codec.quic.QuicConnectionIdGenerator connectionIdAddressGenerator)
Set the
QuicConnectionIdGenerator to use. |
static QuicServer |
create()
Prepare a
QuicServer |
T |
datagram(int recvQueueLen,
int sendQueueLen)
If configured this will enable
Datagram support.
|
T |
doOnBind(Consumer<? super CONF> doOnBind)
Set or add a callback called when
QuicTransport is about to start listening for incoming traffic. |
T |
doOnBound(Consumer<? super Connection> doOnBound)
Set or add a callback called after
QuicTransport has been started. |
QuicServer |
doOnConnection(Consumer<? super QuicConnection> doOnConnection)
Set or add a callback called on new remote
QuicConnection . |
T |
doOnUnbound(Consumer<? super Connection> doOnUnbound)
Set or add a callback called after
QuicTransport has been shutdown. |
T |
grease(boolean enable)
Set if greasing should be enabled
or not.
|
T |
handleStream(BiFunction<? super QuicInbound,? super QuicOutbound,? extends Publisher<Void>> streamHandler)
Attach an IO handler to react on incoming stream.
|
QuicServer |
host(String host)
The host to which this server should bind.
|
T |
hystart(boolean enable)
Enable/disable Hystart.
|
T |
idleTimeout(Duration idleTimeout)
Set the maximum idle timeout (resolution: ms)
See
set_max_idle_timeout.
|
T |
initialSettings(Consumer<QuicInitialSettingsSpec.Builder> initialSettings)
Configure QUIC initial settings
|
T |
localConnectionIdLength(int localConnectionIdLength)
Sets the local connection id length that is used.
|
T |
maxAckDelay(Duration maxAckDelay)
Set max ACK delay (resolution: ms).
|
T |
maxRecvUdpPayloadSize(long maxRecvUdpPayloadSize)
|
T |
maxSendUdpPayloadSize(long maxSendUdpPayloadSize)
|
QuicServer |
port(int port)
The port to which this server should bind.
|
T |
secure(Function<io.netty.incubator.codec.quic.QuicChannel,? extends io.netty.incubator.codec.quic.QuicSslEngine> sslEngineProvider)
|
T |
secure(io.netty.incubator.codec.quic.QuicSslContext sslContext)
The
QuicSslContext that will be used to create QuicSslEngine s for QuicChannel s. |
<A> T |
streamAttr(io.netty.util.AttributeKey<A> key,
A value)
Injects default attribute to the future
QuicStreamChannel . |
T |
streamObserve(ConnectionObserver observer)
Set or add the given
ConnectionObserver for each stream |
<A> T |
streamOption(io.netty.channel.ChannelOption<A> key,
A value)
Injects default options to the future
QuicStreamChannel . |
QuicServer |
tokenHandler(io.netty.incubator.codec.quic.QuicTokenHandler tokenHandler)
Configure the
QuicTokenHandler that is used to generate and validate tokens. |
Mono<Void> |
warmup()
Based on the actual configuration, returns a
Mono that triggers:
an initialization of the event loop group
loads the necessary native libraries for the transport
By default, when method is not used, the bind operation absorbs the extra time needed to load resources. |
attr, bindAddress, channelGroup, configuration, doOnChannelInit, duplicate, metrics, metrics, observe, option, runOn, runOn, runOn, wiretap, wiretap, wiretap, wiretap, wiretap
public static QuicServer create()
QuicServer
QuicServer
public abstract Mono<? extends Connection> bind()
QuicServer
and returns a Mono
of Connection
. If
Mono
is cancelled, the underlying binding will be aborted. Once the Connection
has been emitted and is not necessary anymore, disposing the main server
loop must be done by the user via DisposableChannel.dispose()
.Mono
of Connection
public final Connection bindNow()
45
seconds). The
returned Connection
offers simple server API, including to DisposableChannel.disposeNow()
shut it down in a blocking fashion.Connection
public final Connection bindNow(Duration timeout)
Connection
offers simple server API, including to DisposableChannel.disposeNow()
shut it down in a blocking fashion.timeout
- max startup timeout (resolution: ns)Connection
public final QuicServer connectionIdAddressGenerator(io.netty.incubator.codec.quic.QuicConnectionIdGenerator connectionIdAddressGenerator)
QuicConnectionIdGenerator
to use.
Default to QuicConnectionIdGenerator.randomGenerator()
.connectionIdAddressGenerator
- the QuicConnectionIdGenerator
to use.QuicServer
referencepublic final QuicServer doOnConnection(Consumer<? super QuicConnection> doOnConnection)
QuicConnection
.doOnConnection
- a consumer observing remote QUIC connectionsQuicServer
referencepublic final QuicServer host(String host)
host
- the host to bind to.QuicServer
referencepublic final QuicServer port(int port)
port
- The port to bind to.QuicServer
referencepublic final QuicServer tokenHandler(io.netty.incubator.codec.quic.QuicTokenHandler tokenHandler)
QuicTokenHandler
that is used to generate and validate tokens.tokenHandler
- the QuicTokenHandler
to useQuicServer
public final T ackDelayExponent(long ackDelayExponent)
ackDelayExponent
- the delay exponent used for ACKs.QuicTransport
referencepublic final T activeMigration(boolean enable)
true
.enable
- true
if migration should be enabled, false
otherwiseQuicTransport
referencepublic final T congestionControlAlgorithm(io.netty.incubator.codec.quic.QuicCongestionControlAlgorithm congestionControlAlgorithm)
QuicCongestionControlAlgorithm.CUBIC
.congestionControlAlgorithm
- the QuicCongestionControlAlgorithm
to use.QuicTransport
referencepublic final T datagram(int recvQueueLen, int sendQueueLen)
recvQueueLen
- the RECV queue length.sendQueueLen
- the SEND queue length.QuicTransport
referencepublic final T doOnBind(Consumer<? super CONF> doOnBind)
QuicTransport
is about to start listening for incoming traffic.doOnBind
- a consumer observing connected eventsQuicTransport
referencepublic final T doOnBound(Consumer<? super Connection> doOnBound)
QuicTransport
has been started.doOnBound
- a consumer observing connected eventsQuicTransport
referencepublic final T doOnUnbound(Consumer<? super Connection> doOnUnbound)
QuicTransport
has been shutdown.doOnUnbound
- a consumer observing unbound eventsQuicTransport
referencepublic final T grease(boolean enable)
true
.enable
- true
if enabled, false
otherwise.QuicTransport
referencepublic final T handleStream(BiFunction<? super QuicInbound,? super QuicOutbound,? extends Publisher<Void>> streamHandler)
Note: If an IO handler is not specified the incoming streams will be closed automatically.
streamHandler
- an IO handler that can dispose underlying connection when Publisher
terminates.QuicTransport
referencepublic final T hystart(boolean enable)
true
.enable
- true
if Hystart should be enabledQuicTransport
referencepublic final T idleTimeout(Duration idleTimeout)
By default idleTimeout
is not specified.
idleTimeout
- the maximum idle timeout (resolution: ms)QuicTransport
referencepublic final T initialSettings(Consumer<QuicInitialSettingsSpec.Builder> initialSettings)
initialSettings
- configures QUIC initial settingsQuicTransport
referencepublic final T localConnectionIdLength(int localConnectionIdLength)
localConnectionIdLength
- the length of local generated connections idsQuicTransport
referencepublic final T maxAckDelay(Duration maxAckDelay)
maxAckDelay
- the max ACK delay (resolution: ms)QuicTransport
referencepublic final T maxRecvUdpPayloadSize(long maxRecvUdpPayloadSize)
maxRecvUdpPayloadSize
- the maximum payload size that is advertised to the remote peer.QuicTransport
referencepublic final T maxSendUdpPayloadSize(long maxSendUdpPayloadSize)
maxSendUdpPayloadSize
- the maximum payload size that is advertised to the remote peer.QuicTransport
referencepublic final T secure(io.netty.incubator.codec.quic.QuicSslContext sslContext)
QuicSslContext
that will be used to create QuicSslEngine
s for QuicChannel
s.sslContext
- the QuicSslContext
QuicTransport
referencepublic final T secure(Function<io.netty.incubator.codec.quic.QuicChannel,? extends io.netty.incubator.codec.quic.QuicSslEngine> sslEngineProvider)
sslEngineProvider
- the Function
that will return the QuicSslEngine
that should be used for the QuicChannel
QuicTransport
referencepublic final <A> T streamAttr(io.netty.util.AttributeKey<A> key, @Nullable A value)
QuicStreamChannel
. It
will be available via AttributeMap.attr(AttributeKey)
.
If the value
is null
, the attribute of the specified key
is removed.A
- the attribute typekey
- the attribute keyvalue
- the attribute value - null to remove a keyQuicTransport
referenceQuicStreamChannelBootstrap.attr(AttributeKey, Object)
,
QuicChannelBootstrap.streamAttr(AttributeKey, Object)
public T streamObserve(ConnectionObserver observer)
ConnectionObserver
for each streamobserver
- the ConnectionObserver
additionQuicTransport
referencepublic final <A> T streamOption(io.netty.channel.ChannelOption<A> key, @Nullable A value)
QuicStreamChannel
. It
will be available via QuicStreamChannel.config()
.
If the value
is null
, the attribute of the specified key
is removed.A
- the option typekey
- the option keyvalue
- the option value - null to remove a keyQuicTransport
referenceQuicStreamChannelBootstrap.option(ChannelOption, Object)
,
QuicChannelBootstrap.streamOption(ChannelOption, Object)
public final Mono<Void> warmup()
Mono
that triggers:
bind operation
absorbs the extra time needed to load resources.Mono
representing the completion of the warmup