rename AsyncSecureClient to AsyncDnssecClient

This commit is contained in:
Benjamin Fry 2019-12-21 15:11:15 -08:00
parent 9918f937f0
commit e96cd0b6e7
4 changed files with 15 additions and 16 deletions

View File

@ -5,14 +5,15 @@ This project adheres to [Semantic Versioning](http://semver.org/).
All notes should be prepended with the location of the change, e.g. `(proto)` or `(resolver)`.
## 0.18.0 Unreleased
## 0.18.0
### Changes
- (all) CHANGELOG.md is now merged from the Resolver crate and the top-level. All notes from the Resolver CHANGELOG were merged into this changelog, with the format `## {version} (Resolver)` and the existing notes from the top-level are formatted as `## {version} (Client/Server`. This should make notes on releases easier. Going forward the scope of changes across crates will be captured as `- ({crate}) {note}` where all is used for across the board updates.
- (all) After the 0.18 release, all crates will be versioned uniformally, and released at the same time, this will resolve some issues around consistency with releases. The final Resolver release before this was `0.12`.
- *breaking* Generally, any interface that took a 0.1 Future, now returns or consumes a std::future::Future
- *breaking* (client) rebranded from `trust-dns` to `trust-dns-client`
- *breaking* (server) rebranded from `trust-dns-server` to `trust-dns`
- *breaking* (named) moved from `trust-dns-server` to `trust-dns`, in bin/**
- *breaking* (all) all internals updated to std::future and async/await (requires `Rust 1.39` minimum)
- *breaking* (client) AsyncClient now returns a connect future which resolves to the client and it's background.
- *breaking* (resolver) AsyncResolver::new changed to AsyncResolver::connect, requires awaiting the returned future

View File

@ -20,20 +20,18 @@ use crate::proto::xfer::{
use crate::proto::SecureDnsHandle;
use crate::proto::TokioTime;
// FIXME: rename to AsyncDnsSecClient
/// A DNSSEC Client implemented over futures-rs.
///
/// This Client is generic and capable of wrapping UDP, TCP, and other underlying DNS protocol
/// implementations.
pub struct AsyncSecureClient<R>
pub struct AsyncDnssecClient<R>
where
R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin,
// FIXME: add memoizer here, to reduce # of requests
{
client: SecureDnsHandle<AsyncClient<R>>,
}
impl<R> AsyncSecureClient<R>
impl<R> AsyncDnssecClient<R>
where
R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin,
{
@ -66,18 +64,18 @@ where
}
}
impl<R> Clone for AsyncSecureClient<R>
impl<R> Clone for AsyncDnssecClient<R>
where
R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin,
{
fn clone(&self) -> Self {
AsyncSecureClient {
AsyncDnssecClient {
client: self.client.clone(),
}
}
}
impl<Resp> DnsHandle for AsyncSecureClient<Resp>
impl<Resp> DnsHandle for AsyncDnssecClient<Resp>
where
Resp: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin,
{
@ -134,7 +132,7 @@ where
}
}
/// A future which will resolve to a AsyncSecureClient
/// A future which will resolve to a AsyncDnssecClient
#[must_use = "futures do nothing unless polled"]
pub struct AsyncSecureClientConnect<F, S, R>
where
@ -154,7 +152,7 @@ where
R: Future<Output = Result<DnsResponse, ProtoError>> + 'static + Send + Unpin,
{
type Output =
Result<(AsyncSecureClient<R>, DnsExchangeBackground<S, R, TokioTime>), ProtoError>;
Result<(AsyncDnssecClient<R>, DnsExchangeBackground<S, R, TokioTime>), ProtoError>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
let result = ready!(self.client_connect.poll_unpin(cx));
@ -164,7 +162,7 @@ where
.expect("TrustAnchor is None, was the future already complete?");
let client_background =
result.map(|(client, bg)| (AsyncSecureClient::from_client(client, trust_anchor), bg));
result.map(|(client, bg)| (AsyncDnssecClient::from_client(client, trust_anchor), bg));
Poll::Ready(client_background)
}
}

View File

@ -19,7 +19,7 @@ use futures::Future;
use tokio::runtime::{self, Runtime};
#[cfg(feature = "dnssec")]
use crate::client::AsyncSecureClient;
use crate::client::AsyncDnssecClient;
use crate::client::{AsyncClient, ClientConnection, ClientHandle};
use crate::error::*;
use crate::proto::{
@ -477,14 +477,14 @@ impl<CC: ClientConnection> SecureSyncClient<CC> {
impl<CC: ClientConnection> Client for SecureSyncClient<CC> {
type Response =
Pin<Box<(dyn Future<Output = Result<DnsResponse, ProtoError>> + Send + 'static)>>;
type Handle = AsyncSecureClient<CC::Response>;
type Handle = AsyncDnssecClient<CC::Response>;
#[allow(clippy::type_complexity)]
fn new_future(&self) -> NewFutureObj<Self::Handle> {
let stream = self.conn.new_stream(self.signer.clone());
let connect = async move {
let (client, bg) = AsyncSecureClient::connect(stream).await?;
let (client, bg) = AsyncDnssecClient::connect(stream).await?;
let bg = Box::new(bg) as _;
Ok((client, bg))

View File

@ -31,7 +31,7 @@ pub use self::async_client::{
};
#[cfg(feature = "dnssec")]
pub use self::async_secure_client::{
AsyncSecureClient, AsyncSecureClientBuilder, AsyncSecureClientConnect,
AsyncDnssecClient, AsyncSecureClientBuilder, AsyncSecureClientConnect,
};
#[cfg(feature = "dnssec")]
pub use self::client::SecureSyncClient;