quic settings
This commit is contained in:
parent
0827e1f566
commit
675476dfea
5 changed files with 175 additions and 9 deletions
|
|
@ -21,12 +21,42 @@ namespace Crafter {
|
|||
const char* what() const noexcept override { return "QUIC connection closed"; }
|
||||
};
|
||||
|
||||
// Transport knobs applied to the msquic Configuration. The defaults
|
||||
// reproduce the values these were hardcoded to before they were made
|
||||
// configurable, so leaving this alone keeps the previous behaviour.
|
||||
//
|
||||
// peerUnidiStreamCount / peerBidiStreamCount cap how many streams the
|
||||
// *peer* may open toward us. msquic defaults both to 0; a server's
|
||||
// HTTP/3 control + QPACK streams alone need 3, and a protocol that
|
||||
// fans data out over many concurrent streams needs correspondingly
|
||||
// more. Raising these costs per-stream flow-control state, so raise
|
||||
// them to what a protocol actually needs rather than to a large
|
||||
// round number.
|
||||
//
|
||||
// keepAliveIntervalMs is client-only (the listener does not set it).
|
||||
// Keep it below idleTimeoutMs or the peer's idle timer will expire.
|
||||
// handshakeIdleTimeoutMs bounds how long a connect attempt to an
|
||||
// unreachable peer takes to fail. This one is set explicitly where it
|
||||
// previously was not: ClientQUIC's constructor waits on a condition
|
||||
// variable with no timeout of its own, so without a bound here a client
|
||||
// dialling a dead port blocks for minutes rather than failing and
|
||||
// retrying. 10s matches msquic's own documented default.
|
||||
export struct QUICSettings {
|
||||
std::uint32_t idleTimeoutMs = 120'000;
|
||||
std::uint32_t handshakeIdleTimeoutMs = 10'000;
|
||||
std::uint32_t keepAliveIntervalMs = 10'000;
|
||||
std::uint16_t peerUnidiStreamCount = 16;
|
||||
std::uint16_t peerBidiStreamCount = 16;
|
||||
bool datagramReceiveEnabled = true;
|
||||
};
|
||||
|
||||
// Server certificate sources. Pick one of (filePaths) or (selfSigned).
|
||||
// selfSigned generates an in-memory ephemeral cert — fine for dev/LAN.
|
||||
export struct QUICServerCredentials {
|
||||
std::string certPath;
|
||||
std::string keyPath;
|
||||
bool selfSigned = false;
|
||||
QUICSettings settings;
|
||||
};
|
||||
|
||||
// Client-side credential validation. By default we require a real cert.
|
||||
|
|
@ -40,6 +70,7 @@ namespace Crafter {
|
|||
export struct QUICClientCredentials {
|
||||
bool insecureNoServerValidation = false;
|
||||
std::array<std::uint8_t, 32> serverCertificateHash{};
|
||||
QUICSettings settings;
|
||||
};
|
||||
|
||||
export class ClientQUIC;
|
||||
|
|
|
|||
Loading…
Reference in a new issue