Struct trust_dns_client::client::AsyncClient
source · [−]pub struct AsyncClient { /* private fields */ }
Expand description
A DNS Client implemented over futures-rs.
This Client is generic and capable of wrapping UDP, TCP, and other underlying DNS protocol implementations.
Implementations
pub fn new<F, S>(
stream: F,
stream_handle: Box<dyn DnsStreamHandle>,
signer: Option<Arc<Signer>>
) -> AsyncClientConnect<DnsMultiplexerConnect<F, S, Signer>, DnsMultiplexer<S, Signer>>ⓘNotable traits for AsyncClientConnect<F, S>impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
F: Future<Output = Result<S, ProtoError>> + Send + Unpin + 'static,
S: DnsClientStream + Unpin + 'static,
pub fn new<F, S>(
stream: F,
stream_handle: Box<dyn DnsStreamHandle>,
signer: Option<Arc<Signer>>
) -> AsyncClientConnect<DnsMultiplexerConnect<F, S, Signer>, DnsMultiplexer<S, Signer>>ⓘNotable traits for AsyncClientConnect<F, S>impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
F: Future<Output = Result<S, ProtoError>> + Send + Unpin + 'static,
S: DnsClientStream + Unpin + 'static,
impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
Spawns a new AsyncClient Stream. This uses a default timeout of 5 seconds for all requests.
Arguments
stream
- A stream of bytes that can be used to send/receive DNS messages (see TcpClientStream or UdpClientStream)stream_handle
- The handle for thestream
on which bytes can be sent/received.signer
- An optional signer for requests, needed for Updates with Sig0, otherwise not needed
pub fn with_timeout<F, S>(
stream: F,
stream_handle: Box<dyn DnsStreamHandle>,
timeout_duration: Duration,
signer: Option<Arc<Signer>>
) -> AsyncClientConnect<DnsMultiplexerConnect<F, S, Signer>, DnsMultiplexer<S, Signer>>ⓘNotable traits for AsyncClientConnect<F, S>impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsClientStream + Unpin + 'static,
pub fn with_timeout<F, S>(
stream: F,
stream_handle: Box<dyn DnsStreamHandle>,
timeout_duration: Duration,
signer: Option<Arc<Signer>>
) -> AsyncClientConnect<DnsMultiplexerConnect<F, S, Signer>, DnsMultiplexer<S, Signer>>ⓘNotable traits for AsyncClientConnect<F, S>impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsClientStream + Unpin + 'static,
impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
Spawns a new AsyncClient Stream.
Arguments
stream
- A stream of bytes that can be used to send/receive DNS messages (see TcpClientStream or UdpClientStream)timeout_duration
- All requests may fail due to lack of response, this is the time to wait for a response before canceling the request.stream_handle
- The handle for thestream
on which bytes can be sent/received.signer
- An optional signer for requests, needed for Updates with Sig0, otherwise not needed
pub fn connect<F, S>(connect_future: F) -> AsyncClientConnect<F, S>ⓘNotable traits for AsyncClientConnect<F, S>impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
S: DnsRequestSender,
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
pub fn connect<F, S>(connect_future: F) -> AsyncClientConnect<F, S>ⓘNotable traits for AsyncClientConnect<F, S>impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
where
S: DnsRequestSender,
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
impl<F, S> Future for AsyncClientConnect<F, S> where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsRequestSender + 'static + Send + Unpin, type Output = Result<(AsyncClient, DnsExchangeBackground<S, TokioTime>), ProtoError>;
Returns a future, which itself wraps a future which is awaiting connection.
The connect_future should be lazy.
Returns
This returns a tuple of Self a handle to send dns messages and an optional background. The background task must be run on an executor before handle is used, if it is Some. If it is None, then another thread has already run the background.
Trait Implementations
type Response = DnsExchangeSend
type Response = DnsExchangeSend
The associated response from the response future, this should resolve to the Response message
type Error = ProtoError
type Error = ProtoError
Error of the response, generally this will be ProtoError
Send a message via the channel in the client Read more
Only returns true if and only if this DNS handle is validating DNSSec. Read more
Auto Trait Implementations
impl !RefUnwindSafe for AsyncClient
impl Send for AsyncClient
impl Sync for AsyncClient
impl Unpin for AsyncClient
impl !UnwindSafe for AsyncClient
Blanket Implementations
Mutably borrows from an owned value. Read more