hickory_proto/h3/
mod.rs

1// Copyright 2015-2018 Benjamin Fry <benjaminfry@me.com>
2//
3// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
4// https://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
5// https://opensource.org/licenses/MIT>, at your option. This file may not be
6// copied, modified, or distributed except according to those terms.
7
8//! TLS protocol related components for DNS over HTTP/3 (DoH3)
9
10mod h3_client_stream;
11pub mod h3_server;
12
13use quinn::{TransportConfig, VarInt};
14
15pub use crate::http::error::{Error as H3Error, Result as H3Result};
16
17pub use self::h3_client_stream::{
18    H3ClientConnect, H3ClientResponse, H3ClientStream, H3ClientStreamBuilder,
19};
20
21const ALPN_H3: &[u8] = b"h3";
22
23/// Returns a default endpoint configuration for DNS-over-QUIC
24fn transport() -> TransportConfig {
25    let mut transport_config = TransportConfig::default();
26
27    transport_config.datagram_receive_buffer_size(None);
28    transport_config.datagram_send_buffer_size(0);
29    // clients never accept new bidirectional streams
30    transport_config.max_concurrent_bidi_streams(VarInt::from_u32(3));
31    // - SETTINGS
32    // - QPACK encoder
33    // - QPACK decoder
34    // - RESERVED (GREASE)
35    transport_config.max_concurrent_uni_streams(VarInt::from_u32(4));
36
37    transport_config
38}