Class TransportConfig.Builder
java.lang.Object
io.github.mahmoudimus.quic.connection.TransportConfig.Builder
- Enclosing class:
TransportConfig
Builds a
TransportConfig. Not thread-safe.-
Method Summary
Modifier and TypeMethodDescriptionactiveConnectionIdLimit(int limit) Theactive_connection_id_limittransport parameter: how many of the peer's connection IDs to keep.allowSpin(boolean allow) Whether to take part in the latency spin bit (RFC 9000 section 17.4); when on, a connection still opts out one time in eight.build()Builds the configuration.Chooses one of the provided congestion controllers with its default settings.A custom congestion controller.cryptoBufferSize(int bytes) The most out-of-order CRYPTO data to buffer per encryption level; more isCRYPTO_BUFFER_EXCEEDED.datagramReceiveBufferSize(int bytes) The DATAGRAM (RFC 9221) receive buffer; the oldest unread datagrams are dropped beyond it. 0 refuses DATAGRAM frames altogether.datagramSendBufferSize(int bytes) The DATAGRAM send buffer; the oldest unsent datagrams are dropped beyond it.initialMtu(int bytes) The UDP payload size to start with, at leastminMtu(int).initialRtt(Duration rtt) The RTT assumed before the first sample.keepAliveInterval(Duration interval) Sends a PING after this much time without sending, to keep an idle connection open.Writes each connection's TLS secrets in theSSLKEYLOGFILEformat, for Wireshark.maxAckDelay(Duration delay) Themax_ack_delaytransport parameter: how long this endpoint may delay ACKs.maxConcurrentBidiStreams(long count) How many bidirectional streams the peer may have open at once.maxConcurrentUniStreams(long count) How many unidirectional streams the peer may have open at once.maxIdleTimeout(Duration timeout) The idle timeout to offer (RFC 9000 section 10.1); the smaller of both sides' applies.maxOutgoingBytesPerSecond(long bytesPerSecond) Caps the sending rate through the pacer.maxUdpPayloadSize(int bytes) Themax_udp_payload_sizetransport parameter: the largest datagram this endpoint receives.minMtu(int bytes) The UDP payload size the path is assumed to carry, at least 1200.mtuDiscovery(boolean enabled) Turns path MTU discovery (RFC 8899) on with its default settings, or off.mtuDiscoveryConfig(MtuDiscoveryConfig config) Path MTU discovery settings, or null to turn it off.packetThreshold(int packets) The packet reordering threshold of loss detection (RFC 9002 section 6.1.1).persistentCongestionThreshold(int ptos) How many PTOs of loss make persistent congestion (RFC 9002 section 7.6).Reports qlog-style events (packets sent, received and lost, metrics, state changes).receiveWindow(long bytes) The receive window of the connection, across streams.sendFairness(boolean fair) Whether streams of equal priority share packets round-robin (true, the default) or one finishes before the next starts.sendWindow(long bytes) The most outgoing stream data to buffer until it is acknowledged.streamReceiveWindow(long bytes) The receive window of each stream: how much the peer may send ahead of what the application read.timeThreshold(double rtts) The time reordering threshold of loss detection, in RTTs (RFC 9002 section 6.1.2).
-
Method Details
-
maxConcurrentBidiStreams
How many bidirectional streams the peer may have open at once.- Parameters:
count- 0 to 260- Returns:
- this builder
-
maxConcurrentUniStreams
How many unidirectional streams the peer may have open at once.- Parameters:
count- 0 to 260- Returns:
- this builder
-
maxIdleTimeout
The idle timeout to offer (RFC 9000 section 10.1); the smaller of both sides' applies.- Parameters:
timeout- the timeout, orDuration.ZEROfor none- Returns:
- this builder
-
streamReceiveWindow
The receive window of each stream: how much the peer may send ahead of what the application read.- Parameters:
bytes- at least 1- Returns:
- this builder
-
receiveWindow
The receive window of the connection, across streams.- Parameters:
bytes- at least 1- Returns:
- this builder
-
sendWindow
The most outgoing stream data to buffer until it is acknowledged. Writers block beyond it.- Parameters:
bytes- at least 1- Returns:
- this builder
-
sendFairness
Whether streams of equal priority share packets round-robin (true, the default) or one finishes before the next starts.- Parameters:
fair- the fairness- Returns:
- this builder
-
packetThreshold
The packet reordering threshold of loss detection (RFC 9002 section 6.1.1).- Parameters:
packets- at least 1- Returns:
- this builder
-
timeThreshold
The time reordering threshold of loss detection, in RTTs (RFC 9002 section 6.1.2).- Parameters:
rtts- more than 1- Returns:
- this builder
-
initialRtt
The RTT assumed before the first sample.- Parameters:
rtt- positive- Returns:
- this builder
-
initialMtu
The UDP payload size to start with, at leastminMtu(int).- Parameters:
bytes- the size- Returns:
- this builder
-
minMtu
The UDP payload size the path is assumed to carry, at least 1200.- Parameters:
bytes- the size- Returns:
- this builder
-
mtuDiscovery
Turns path MTU discovery (RFC 8899) on with its default settings, or off.- Parameters:
enabled- whether to probe for a larger MTU- Returns:
- this builder
-
mtuDiscoveryConfig
Path MTU discovery settings, or null to turn it off.- Parameters:
config- the settings- Returns:
- this builder
-
persistentCongestionThreshold
How many PTOs of loss make persistent congestion (RFC 9002 section 7.6).- Parameters:
ptos- at least 1- Returns:
- this builder
-
keepAliveInterval
Sends a PING after this much time without sending, to keep an idle connection open.- Parameters:
interval- the interval, or null for none (the default)- Returns:
- this builder
-
cryptoBufferSize
The most out-of-order CRYPTO data to buffer per encryption level; more isCRYPTO_BUFFER_EXCEEDED.- Parameters:
bytes- at least 1- Returns:
- this builder
-
allowSpin
Whether to take part in the latency spin bit (RFC 9000 section 17.4); when on, a connection still opts out one time in eight.- Parameters:
allow- whether to spin- Returns:
- this builder
-
datagramReceiveBufferSize
The DATAGRAM (RFC 9221) receive buffer; the oldest unread datagrams are dropped beyond it. 0 refuses DATAGRAM frames altogether.- Parameters:
bytes- 0 or more- Returns:
- this builder
-
datagramSendBufferSize
The DATAGRAM send buffer; the oldest unsent datagrams are dropped beyond it.- Parameters:
bytes- at least 1- Returns:
- this builder
-
congestionControl
Chooses one of the provided congestion controllers with its default settings.- Parameters:
control- the controller- Returns:
- this builder
-
congestionControllerFactory
A custom congestion controller.- Parameters:
factory- builds one controller per connection- Returns:
- this builder
-
maxOutgoingBytesPerSecond
Caps the sending rate through the pacer.- Parameters:
bytesPerSecond- the cap, or -1 for none (the default)- Returns:
- this builder
-
maxAckDelay
Themax_ack_delaytransport parameter: how long this endpoint may delay ACKs.- Parameters:
delay- below 214 ms- Returns:
- this builder
-
activeConnectionIdLimit
Theactive_connection_id_limittransport parameter: how many of the peer's connection IDs to keep.- Parameters:
limit- at least 2- Returns:
- this builder
-
maxUdpPayloadSize
Themax_udp_payload_sizetransport parameter: the largest datagram this endpoint receives.- Parameters:
bytes- 1200 to 65527- Returns:
- this builder
-
keyLog
Writes each connection's TLS secrets in theSSLKEYLOGFILEformat, for Wireshark. For debugging only: anyone with the log can decrypt the traffic.- Parameters:
keyLog- the destination, or null for none (the default)- Returns:
- this builder
-
qlog
Reports qlog-style events (packets sent, received and lost, metrics, state changes).- Parameters:
sink- the destination, or null for none (the default)- Returns:
- this builder
-
build
Builds the configuration.- Returns:
- the configuration
- Throws:
IllegalArgumentException- if the MTU settings are inconsistent
-