hickory_proto/http/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//! HTTP protocol related components for DNS over HTTP/2 (DoH) and HTTP/3 (DoH3)
9
10pub(crate) const MIME_APPLICATION_DNS: &str = "application/dns-message";
11
12/// The default query path for DNS-over-HTTPS if none was given.
13pub const DEFAULT_DNS_QUERY_PATH: &str = "/dns-query";
14
15pub(crate) mod error;
16pub mod request;
17pub mod response;
18
19/// Represents a version of the HTTP spec.
20#[derive(Clone, Copy, Debug)]
21pub enum Version {
22 /// HTTP/2 for DoH.
23 #[cfg(feature = "__https")]
24 Http2,
25 /// HTTP/3 for DoH3.
26 #[cfg(feature = "__h3")]
27 Http3,
28}
29
30impl Version {
31 fn to_http(self) -> http::Version {
32 match self {
33 #[cfg(feature = "__https")]
34 Self::Http2 => http::Version::HTTP_2,
35 #[cfg(feature = "__h3")]
36 Self::Http3 => http::Version::HTTP_3,
37 }
38 }
39}