Rename HTTPS implementation to H2
This commit is contained in:
parent
ebb098de38
commit
f10faa3516
@ -20,7 +20,7 @@ use rustls::{Certificate, ClientConfig, OwnedTrustAnchor, RootCertStore};
|
||||
use tokio::net::TcpStream as TokioTcpStream;
|
||||
use tokio::runtime::Runtime;
|
||||
use trust_dns_client::client::*;
|
||||
use trust_dns_proto::https::HttpsClientStreamBuilder;
|
||||
use trust_dns_proto::h2::HttpsClientStreamBuilder;
|
||||
use trust_dns_proto::iocompat::AsyncIoTokioAsStd;
|
||||
|
||||
use server_harness::{named_test_harness, query_a};
|
||||
|
@ -12,7 +12,7 @@ use std::net::SocketAddr;
|
||||
use std::sync::Arc;
|
||||
|
||||
use rustls::ClientConfig;
|
||||
use trust_dns_proto::https::{HttpsClientConnect, HttpsClientStream, HttpsClientStreamBuilder};
|
||||
use trust_dns_proto::h2::{HttpsClientConnect, HttpsClientStream, HttpsClientStreamBuilder};
|
||||
use trust_dns_proto::tcp::Connect;
|
||||
|
||||
use crate::client::{ClientConnection, Signer};
|
@ -282,15 +282,15 @@ pub mod udp;
|
||||
|
||||
// TODO: consider removing tcp/udp/https modules...
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
mod https_client_connection;
|
||||
mod h2_client_connection;
|
||||
|
||||
pub use trust_dns_proto as proto;
|
||||
|
||||
/// The https module which contains all https related connection types
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "dns-over-https")))]
|
||||
pub mod https {
|
||||
pub use super::https_client_connection::HttpsClientConnection;
|
||||
pub mod h2 {
|
||||
pub use super::h2_client_connection::HttpsClientConnection;
|
||||
}
|
||||
|
||||
/// Returns a version as specified in Cargo.toml
|
||||
|
@ -18,8 +18,8 @@ use http::header::CONTENT_LENGTH;
|
||||
use http::{Method, Request};
|
||||
use tracing::debug;
|
||||
|
||||
use crate::h2::HttpsError;
|
||||
use crate::http::Version;
|
||||
use crate::https::HttpsError;
|
||||
|
||||
/// Given an HTTP request, return a future that will result in the next sequence of bytes.
|
||||
///
|
@ -7,11 +7,11 @@
|
||||
|
||||
//! TLS protocol related components for DNS over HTTPS (DoH)
|
||||
|
||||
mod https_client_stream;
|
||||
pub mod https_server;
|
||||
mod h2_client_stream;
|
||||
pub mod h2_server;
|
||||
|
||||
pub use crate::http::error::{Error as HttpsError, Result as HttpsResult};
|
||||
|
||||
pub use self::https_client_stream::{
|
||||
pub use self::h2_client_stream::{
|
||||
HttpsClientConnect, HttpsClientResponse, HttpsClientStream, HttpsClientStreamBuilder,
|
||||
};
|
@ -62,6 +62,9 @@ pub fn spawn_bg<F: Future<Output = R> + Send + 'static, R: Send + 'static>(
|
||||
}
|
||||
|
||||
pub mod error;
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "dns-over-https")))]
|
||||
pub mod h2;
|
||||
#[cfg(feature = "dns-over-h3")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "dns-over-h3")))]
|
||||
pub mod h3;
|
||||
@ -71,9 +74,6 @@ pub mod h3;
|
||||
doc(cfg(any(feature = "dns-over-https", feature = "dns-over-h3")))
|
||||
)]
|
||||
pub mod http;
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "dns-over-https")))]
|
||||
pub mod https;
|
||||
#[cfg(feature = "mdns")]
|
||||
#[cfg_attr(docsrs, doc(cfg(feature = "mdns")))]
|
||||
pub mod multicast;
|
||||
|
@ -10,7 +10,7 @@ use std::net::SocketAddr;
|
||||
|
||||
use crate::tls::CLIENT_CONFIG;
|
||||
|
||||
use proto::https::{HttpsClientConnect, HttpsClientStream, HttpsClientStreamBuilder};
|
||||
use proto::h2::{HttpsClientConnect, HttpsClientStream, HttpsClientStreamBuilder};
|
||||
use proto::tcp::{Connect, DnsTcpStream};
|
||||
use proto::xfer::{DnsExchange, DnsExchangeConnect};
|
||||
use proto::TokioTime;
|
@ -259,11 +259,11 @@ pub mod config;
|
||||
pub mod dns_lru;
|
||||
pub mod dns_sd;
|
||||
pub mod error;
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
mod h2;
|
||||
#[cfg(feature = "dns-over-h3")]
|
||||
mod h3;
|
||||
mod hosts;
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
mod https;
|
||||
pub mod lookup;
|
||||
pub mod lookup_ip;
|
||||
// TODO: consider #[doc(hidden)]
|
||||
|
@ -31,10 +31,10 @@ use tokio_openssl::SslStream as TokioTlsStream;
|
||||
use tokio_rustls::client::TlsStream as TokioTlsStream;
|
||||
|
||||
use crate::config::{NameServerConfig, Protocol, ResolverOpts};
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
use proto::h2::{HttpsClientConnect, HttpsClientStream};
|
||||
#[cfg(feature = "dns-over-h3")]
|
||||
use proto::h3::{H3ClientConnect, H3ClientStream};
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
use proto::https::{HttpsClientConnect, HttpsClientStream};
|
||||
#[cfg(feature = "mdns")]
|
||||
use proto::multicast::{MdnsClientConnect, MdnsClientStream, MdnsQueryType};
|
||||
#[cfg(feature = "dns-over-quic")]
|
||||
@ -354,7 +354,7 @@ impl<P: RuntimeProvider> ConnectionProvider for GenericConnector<P> {
|
||||
let client_config = config.tls_config.clone();
|
||||
let tcp_future = self.runtime_provider.connect_tcp(socket_addr);
|
||||
|
||||
let exchange = crate::https::new_https_stream_with_future(
|
||||
let exchange = crate::h2::new_https_stream_with_future(
|
||||
tcp_future,
|
||||
socket_addr,
|
||||
tls_dns_name,
|
||||
|
@ -17,7 +17,7 @@ use trust_dns_proto::{http::Version, rr::Record};
|
||||
|
||||
use crate::{
|
||||
authority::MessageResponse,
|
||||
proto::https::https_server,
|
||||
proto::h2::h2_server,
|
||||
server::{
|
||||
request_handler::RequestHandler, response_handler::ResponseHandler, server_future,
|
||||
Protocol, ResponseInfo,
|
||||
@ -71,7 +71,7 @@ pub(crate) async fn h2_handler<T, I>(
|
||||
let responder = HttpsResponseHandle(Arc::new(Mutex::new(respond)));
|
||||
|
||||
tokio::spawn(async move {
|
||||
match https_server::message_from(dns_hostname, request).await {
|
||||
match h2_server::message_from(dns_hostname, request).await {
|
||||
Ok(bytes) => handle_request(bytes, src_addr, handler, responder).await,
|
||||
Err(err) => warn!("error while handling request from {}: {}", src_addr, err),
|
||||
};
|
||||
@ -108,8 +108,8 @@ impl ResponseHandler for HttpsResponseHandle {
|
||||
impl Iterator<Item = &'a Record> + Send + 'a,
|
||||
>,
|
||||
) -> io::Result<ResponseInfo> {
|
||||
use crate::proto::h2::HttpsError;
|
||||
use crate::proto::http::response;
|
||||
use crate::proto::https::HttpsError;
|
||||
use crate::proto::serialize::binary::BinEncoder;
|
||||
|
||||
let mut bytes = Vec::with_capacity(512);
|
@ -7,10 +7,10 @@
|
||||
|
||||
//! `Server` component for hosting a domain name servers operations.
|
||||
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
mod h2_handler;
|
||||
#[cfg(feature = "dns-over-h3")]
|
||||
mod h3_handler;
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
mod https_handler;
|
||||
mod protocol;
|
||||
#[cfg(feature = "dns-over-quic")]
|
||||
mod quic_handler;
|
||||
|
@ -595,7 +595,7 @@ impl<T: RequestHandler> ServerFuture<T> {
|
||||
use tokio_rustls::TlsAcceptor;
|
||||
|
||||
use crate::proto::rustls::tls_server;
|
||||
use crate::server::https_handler::h2_handler;
|
||||
use crate::server::h2_handler::h2_handler;
|
||||
|
||||
let dns_hostname: Option<Arc<str>> = dns_hostname.map(|n| n.into());
|
||||
|
||||
|
@ -132,7 +132,7 @@ fn test_query_tcp_ipv6() {
|
||||
#[cfg(feature = "dns-over-https-rustls")]
|
||||
fn test_query_https() {
|
||||
use rustls::{ClientConfig, OwnedTrustAnchor, RootCertStore};
|
||||
use trust_dns_proto::https::HttpsClientStreamBuilder;
|
||||
use trust_dns_proto::h2::HttpsClientStreamBuilder;
|
||||
|
||||
const ALPN_H2: &[u8] = b"h2";
|
||||
|
||||
|
@ -314,7 +314,7 @@ async fn https(_opts: Opts) -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
#[cfg(feature = "dns-over-https")]
|
||||
async fn https(opts: Opts) -> Result<(), Box<dyn std::error::Error>> {
|
||||
use trust_dns_proto::https::HttpsClientStreamBuilder;
|
||||
use trust_dns_proto::h2::HttpsClientStreamBuilder;
|
||||
|
||||
let nameserver = opts.nameserver;
|
||||
let alpn = opts
|
||||
|
Loading…
Reference in New Issue
Block a user