Package reactor.netty.quic
Class QuicServer
java.lang.Object
reactor.netty.transport.Transport<T,CONF>
 
reactor.netty.quic.QuicServer
A QuicServer allows building in a safe immutable way a QUIC server that is materialized
 and bound when 
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();
 
 - Author:
- Violeta Georgieva
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionfinal QuicServerackDelayExponent(long ackDelayExponent) Set the delay exponent used for ACKs.final QuicServeractiveMigration(boolean enable) Enable/disable active migration.abstract Mono<? extends Connection>bind()final ConnectionbindNow()Starts the server in a blocking fashion, and waits for it to finish initializing or the startup timeout expires (the startup timeout is45seconds).final ConnectionStart the server in a blocking fashion, and wait for it to finish initializing or the provided startup timeout expires.final QuicServercongestionControlAlgorithm(QuicCongestionControlAlgorithm congestionControlAlgorithm) Set the congestion control algorithm to use.final QuicServerconnectionIdAddressGenerator(QuicConnectionIdGenerator connectionIdAddressGenerator) Set theQuicConnectionIdGeneratorto use.static QuicServercreate()Prepare aQuicServer.final QuicServerdatagram(int recvQueueLen, int sendQueueLen) If configured this will enable Datagram support.final QuicServerdoOnBind(Consumer<? super QuicServerConfig> doOnBind) Set or add a callback called whenQuicTransportis about to start listening for incoming traffic.final QuicServerdoOnBound(Consumer<? super Connection> doOnBound) Set or add a callback called afterQuicTransporthas been started.final QuicServerdoOnConnection(Consumer<? super QuicConnection> doOnConnection) Set or add a callback called on new remoteQuicConnection.final QuicServerdoOnUnbound(Consumer<? super Connection> doOnUnbound) Set or add a callback called afterQuicTransporthas been shutdown.final QuicServergrease(boolean enable) Set if greasing should be enabled or not.final QuicServerhandleStream(BiFunction<? super QuicInbound, ? super QuicOutbound, ? extends Publisher<Void>> streamHandler) Attach an IO handler to react on incoming stream.final QuicServerThe host to which this server should bind.final QuicServerhystart(boolean enable) Enable/disable Hystart.final QuicServeridleTimeout(Duration idleTimeout) Set the maximum idle timeout (resolution: ms) See set_max_idle_timeout.final QuicServerinitialSettings(Consumer<QuicInitialSettingsSpec.Builder> initialSettings) Configure QUIC initial settings.final QuicServerlocalConnectionIdLength(int localConnectionIdLength) Sets the local connection id length that is used.final QuicServermaxAckDelay(Duration maxAckDelay) Set max ACK delay (resolution: ms).final QuicServermaxRecvUdpPayloadSize(long maxRecvUdpPayloadSize) final QuicServermaxSendUdpPayloadSize(long maxSendUdpPayloadSize) final QuicServerport(int port) The port to which this server should bind.final QuicServersecure(QuicSslContext sslContext) final QuicServersecure(Function<QuicChannel, ? extends QuicSslEngine> sslEngineProvider) final <A> QuicServerstreamAttr(AttributeKey<A> key, @Nullable A value) Injects default attribute to the futureQuicStreamChannel.streamObserve(ConnectionObserver observer) Set or add the givenConnectionObserverfor each stream.final <A> QuicServerstreamOption(ChannelOption<A> key, @Nullable A value) Injects default options to the futureQuicStreamChannel.final QuicServertokenHandler(QuicTokenHandler tokenHandler) Configure theQuicTokenHandlerthat is used to generate and validate tokens.warmup()Based on the actual configuration, returns aMonothat triggers: an initialization of the event loop group loads the necessary native libraries for the transport By default, when method is not used, thebind operationabsorbs the extra time needed to load resources.Methods inherited from class reactor.netty.transport.Transportattr, bindAddress, channelGroup, configuration, doOnChannelInit, duplicate, metrics, metrics, observe, option, runOn, runOn, runOn, wiretap, wiretap, wiretap, wiretap, wiretap
- 
Constructor Details- 
QuicServerpublic QuicServer()
 
- 
- 
Method Details- 
createPrepare aQuicServer.- Returns:
- a QuicServer
 
- 
bindBinds theQuicServerand returns aMonoofConnection. IfMonois cancelled, the underlying binding will be aborted. Once theConnectionhas been emitted and is not necessary anymore, disposing the main server loop must be done by the user viaDisposableChannel.dispose().- Returns:
- a MonoofConnection
 
- 
bindNowStarts the server in a blocking fashion, and waits for it to finish initializing or the startup timeout expires (the startup timeout is45seconds). The returnedConnectionoffers simple server API, including toDisposableChannel.disposeNow()shut it down in a blocking fashion.- Returns:
- a Connection
 
- 
bindNowStart the server in a blocking fashion, and wait for it to finish initializing or the provided startup timeout expires. The returnedConnectionoffers simple server API, including toDisposableChannel.disposeNow()shut it down in a blocking fashion.- Parameters:
- timeout- max startup timeout (resolution: ns)
- Returns:
- a Connection
 
- 
connectionIdAddressGeneratorpublic final QuicServer connectionIdAddressGenerator(QuicConnectionIdGenerator connectionIdAddressGenerator) Set theQuicConnectionIdGeneratorto use. Default toQuicConnectionIdGenerator.randomGenerator().- Parameters:
- connectionIdAddressGenerator- the- QuicConnectionIdGeneratorto use.
- Returns:
- a QuicServerreference
 
- 
doOnConnectionSet or add a callback called on new remoteQuicConnection.- Parameters:
- doOnConnection- a consumer observing remote QUIC connections
- Returns:
- a QuicServerreference
 
- 
hostThe host to which this server should bind.- Parameters:
- host- the host to bind to.
- Returns:
- a QuicServerreference
 
- 
portThe port to which this server should bind. If a port is not specified, the system picks up an ephemeral port.- Parameters:
- port- The port to bind to.
- Returns:
- a QuicServerreference
 
- 
tokenHandlerConfigure theQuicTokenHandlerthat is used to generate and validate tokens.- Parameters:
- tokenHandler- the- QuicTokenHandlerto use
- Returns:
- a QuicServer
 
- 
ackDelayExponentSet the delay exponent used for ACKs. See set_ack_delay_exponent. Default to 3.- Parameters:
- ackDelayExponent- the delay exponent used for ACKs.
- Returns:
- a QuicTransportreference
 
- 
activeMigrationEnable/disable active migration. See set_disable_active_migration. Default totrue.- Parameters:
- enable-- trueif migration should be enabled,- falseotherwise
- Returns:
- a QuicTransportreference
 
- 
congestionControlAlgorithmpublic final QuicServer congestionControlAlgorithm(QuicCongestionControlAlgorithm congestionControlAlgorithm) Set the congestion control algorithm to use. Default toQuicCongestionControlAlgorithm.CUBIC.- Parameters:
- congestionControlAlgorithm- the- QuicCongestionControlAlgorithmto use.
- Returns:
- a QuicTransportreference
 
- 
datagramIf configured this will enable Datagram support.- Parameters:
- recvQueueLen- the RECV queue length.
- sendQueueLen- the SEND queue length.
- Returns:
- a QuicTransportreference
 
- 
doOnBindSet or add a callback called whenQuicTransportis about to start listening for incoming traffic.- Parameters:
- doOnBind- a consumer observing connected events
- Returns:
- a QuicTransportreference
 
- 
doOnBoundSet or add a callback called afterQuicTransporthas been started.- Parameters:
- doOnBound- a consumer observing connected events
- Returns:
- a QuicTransportreference
 
- 
doOnUnboundSet or add a callback called afterQuicTransporthas been shutdown.- Parameters:
- doOnUnbound- a consumer observing unbound events
- Returns:
- a QuicTransportreference
 
- 
greaseSet if greasing should be enabled or not. Default totrue.- Parameters:
- enable-- trueif enabled,- falseotherwise.
- Returns:
- a QuicTransportreference
 
- 
handleStreampublic final QuicServer handleStream(BiFunction<? super QuicInbound, ? super QuicOutbound, ? extends Publisher<Void>> streamHandler) Attach an IO handler to react on incoming stream.Note: If an IO handler is not specified the incoming streams will be closed automatically. - Parameters:
- streamHandler- an IO handler that can dispose underlying connection when- Publisherterminates.
- Returns:
- a QuicTransportreference
 
- 
hystartEnable/disable Hystart. See enable_hystart. Default totrue.- Parameters:
- enable-- trueif Hystart should be enabled
- Returns:
- a QuicTransportreference
 
- 
idleTimeoutSet the maximum idle timeout (resolution: ms) See set_max_idle_timeout.By default idleTimeoutis not specified.- Parameters:
- idleTimeout- the maximum idle timeout (resolution: ms)
- Returns:
- a QuicTransportreference
 
- 
initialSettingsConfigure QUIC initial settings.- Parameters:
- initialSettings- configures QUIC initial settings
- Returns:
- a QuicTransportreference
 
- 
localConnectionIdLengthSets the local connection id length that is used. Default 20, which is also the maximum that is supported.- Parameters:
- localConnectionIdLength- the length of local generated connections ids
- Returns:
- a QuicTransportreference
 
- 
maxAckDelaySet max ACK delay (resolution: ms). See set_max_ack_delay. Default to 25 ms.- Parameters:
- maxAckDelay- the max ACK delay (resolution: ms)
- Returns:
- a QuicTransportreference
 
- 
maxRecvUdpPayloadSizeSee set_max_recv_udp_payload_size. The default value is 65527.- Parameters:
- maxRecvUdpPayloadSize- the maximum payload size that is advertised to the remote peer.
- Returns:
- a QuicTransportreference
 
- 
maxSendUdpPayloadSizeSee set_max_send_udp_payload_size. The default and minimum value is 1200.- Parameters:
- maxSendUdpPayloadSize- the maximum payload size that is advertised to the remote peer.
- Returns:
- a QuicTransportreference
 
- 
secure- Parameters:
- sslContext- the- QuicSslContext
- Returns:
- a QuicTransportreference
 
- 
secure- Parameters:
- sslEngineProvider- the- Functionthat will return the- QuicSslEnginethat should be used for the- QuicChannel
- Returns:
- a QuicTransportreference
 
- 
streamAttrInjects default attribute to the futureQuicStreamChannel. It will be available viaAttributeMap.attr(AttributeKey). If thevalueisnull, the attribute of the specifiedkeyis removed.- Type Parameters:
- A- the attribute type
- Parameters:
- key- the attribute key
- value- the attribute value - null to remove a key
- Returns:
- a QuicTransportreference
- See Also:
 
- 
streamObserveSet or add the givenConnectionObserverfor each stream.- Parameters:
- observer- the- ConnectionObserveraddition
- Returns:
- a QuicTransportreference
 
- 
streamOptionInjects default options to the futureQuicStreamChannel. It will be available viaQuicStreamChannel.config(). If thevalueisnull, the attribute of the specifiedkeyis removed.- Type Parameters:
- A- the option type
- Parameters:
- key- the option key
- value- the option value - null to remove a key
- Returns:
- a QuicTransportreference
- See Also:
 
- 
warmupBased on the actual configuration, returns aMonothat triggers:- an initialization of the event loop group
- loads the necessary native libraries for the transport
 bind operationabsorbs the extra time needed to load resources.- Returns:
- a Monorepresenting the completion of the warmup
 
 
-