Class EndpointConfig.Builder
java.lang.Object
io.github.mahmoudimus.quic.connection.EndpointConfig.Builder
- Enclosing class:
EndpointConfig
Builds an
EndpointConfig. Not thread-safe.-
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the configuration.cidGenerator(ConnectionIdGenerator generator) The local connection ID generator.cidLength(int length) Random local connection IDs of a length.minResetInterval(Duration interval) The least time between two stateless resets, which bounds what spoofed packets can make the endpoint send.random(SecureRandom random) The source of randomness for the endpoint and its connections: connection IDs (unless acidGeneratoris set), the reset key (unless one is set), packet number skipping, padding, Retry and NEW_TOKEN nonces.resetKey(byte[] key) The secret stateless reset tokens are derived from.supportedVersions(QuicVersion... versions) The QUIC versions to accept.
-
Method Details
-
random
The source of randomness for the endpoint and its connections: connection IDs (unless acidGeneratoris set), the reset key (unless one is set), packet number skipping, padding, Retry and NEW_TOKEN nonces. By default each endpoint makes aSecureRandomof its own; a seeded one makes test runs reproducible, and must never be used outside tests.- Parameters:
random- the source, used from the endpoint's thread- Returns:
- this builder
-
cidGenerator
The local connection ID generator. Its length is fixed for the endpoint; a length of 0 routes packets by the peer's address instead (zero-length connection IDs).- Parameters:
generator- the generator; must be thread-safe- Returns:
- this builder
-
cidLength
Random local connection IDs of a length.- Parameters:
length- 0 to 20 bytes- Returns:
- this builder
-
resetKey
The secret stateless reset tokens are derived from. Endpoints that should be able to reset each other's connections after a restart share it.- Parameters:
key- at least 32 bytes- Returns:
- this builder
-
supportedVersions
The QUIC versions to accept. A server answers others with Version Negotiation.- Parameters:
versions- one or more versions, in preference order- Returns:
- this builder
-
minResetInterval
The least time between two stateless resets, which bounds what spoofed packets can make the endpoint send.- Parameters:
interval- the interval- Returns:
- this builder
-
build
Builds the configuration.- Returns:
- the configuration
-