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";
11pub(crate) const DNS_QUERY_PATH: &str = "/dns-query";
12
13pub(crate) mod error;
14pub mod request;
15pub mod response;
16
17/// Represents a version of the HTTP spec.
18#[derive(Clone, Copy, Debug)]
19pub enum Version {
20    /// HTTP/2 for DoH.
21    #[cfg(feature = "dns-over-https")]
22    Http2,
23    /// HTTP/3 for DoH3.
24    #[cfg(feature = "dns-over-h3")]
25    Http3,
26}
27
28impl Version {
29    fn to_http(self) -> http::Version {
30        match self {
31            #[cfg(feature = "dns-over-https")]
32            Self::Http2 => http::Version::HTTP_2,
33            #[cfg(feature = "dns-over-h3")]
34            Self::Http3 => http::Version::HTTP_3,
35        }
36    }
37}