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§
source§impl AsyncClient
impl AsyncClient
sourcepub async fn new<F, S>(
stream: F,
stream_handle: BufDnsStreamHandle,
signer: Option<Arc<Signer>>
) -> Result<(Self, DnsExchangeBackground<DnsMultiplexer<S, Signer>, TokioTime>), ProtoError>where
F: Future<Output = Result<S, ProtoError>> + Send + Unpin + 'static,
S: DnsClientStream + 'static + Unpin,
pub async fn new<F, S>( stream: F, stream_handle: BufDnsStreamHandle, signer: Option<Arc<Signer>> ) -> Result<(Self, DnsExchangeBackground<DnsMultiplexer<S, Signer>, TokioTime>), ProtoError>where F: Future<Output = Result<S, ProtoError>> + Send + Unpin + 'static, S: DnsClientStream + 'static + Unpin,
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 thestreamon which bytes can be sent/received.signer- An optional signer for requests, needed for Updates with Sig0, otherwise not needed
sourcepub async fn with_timeout<F, S>(
stream: F,
stream_handle: BufDnsStreamHandle,
timeout_duration: Duration,
signer: Option<Arc<Signer>>
) -> Result<(Self, DnsExchangeBackground<DnsMultiplexer<S, Signer>, TokioTime>), ProtoError>where
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
S: DnsClientStream + 'static + Unpin,
pub async fn with_timeout<F, S>( stream: F, stream_handle: BufDnsStreamHandle, timeout_duration: Duration, signer: Option<Arc<Signer>> ) -> Result<(Self, DnsExchangeBackground<DnsMultiplexer<S, Signer>, TokioTime>), ProtoError>where F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin, S: DnsClientStream + 'static + Unpin,
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 thestreamon which bytes can be sent/received.signer- An optional signer for requests, needed for Updates with Sig0, otherwise not needed
sourcepub async fn connect<F, S>(
connect_future: F
) -> Result<(Self, DnsExchangeBackground<S, TokioTime>), ProtoError>where
S: DnsRequestSender,
F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
pub async fn connect<F, S>( connect_future: F ) -> Result<(Self, DnsExchangeBackground<S, TokioTime>), ProtoError>where S: DnsRequestSender, F: Future<Output = Result<S, ProtoError>> + 'static + Send + Unpin,
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.
sourcepub fn enable_edns(&mut self)
pub fn enable_edns(&mut self)
(Re-)enable usage of EDNS for outgoing messages
sourcepub fn disable_edns(&mut self)
pub fn disable_edns(&mut self)
Disable usage of EDNS for outgoing messages
Trait Implementations§
source§impl Clone for AsyncClient
impl Clone for AsyncClient
source§fn clone(&self) -> AsyncClient
fn clone(&self) -> AsyncClient
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl DnsHandle for AsyncClient
impl DnsHandle for AsyncClient
§type Response = DnsExchangeSend
type Response = DnsExchangeSend
The associated response from the response stream, this should resolve to the Response messages
§type Error = ProtoError
type Error = ProtoError
Error of the response, generally this will be
ProtoErrorsource§fn send<R: Into<DnsRequest> + Unpin + Send + 'static>(
&mut self,
request: R
) -> Self::Response
fn send<R: Into<DnsRequest> + Unpin + Send + 'static>( &mut self, request: R ) -> Self::Response
Send a message via the channel in the client Read more
source§fn is_using_edns(&self) -> bool
fn is_using_edns(&self) -> bool
Allow for disabling EDNS
source§fn is_verifying_dnssec(&self) -> bool
fn is_verifying_dnssec(&self) -> bool
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> ClientHandle for Twhere
T: DnsHandle<Error = ProtoError>,
impl<T> ClientHandle for Twhere T: DnsHandle<Error = ProtoError>,
source§fn query(
&mut self,
name: Name,
query_class: DNSClass,
query_type: RecordType
) -> ClientResponse<<Self as DnsHandle>::Response>
fn query( &mut self, name: Name, query_class: DNSClass, query_type: RecordType ) -> ClientResponse<<Self as DnsHandle>::Response>
A classic DNS query Read more
source§fn notify<R>(
&mut self,
name: Name,
query_class: DNSClass,
query_type: RecordType,
rrset: Option<R>
) -> ClientResponse<<Self as DnsHandle>::Response>where
R: Into<RecordSet>,
fn notify<R>( &mut self, name: Name, query_class: DNSClass, query_type: RecordType, rrset: Option<R> ) -> ClientResponse<<Self as DnsHandle>::Response>where R: Into<RecordSet>,
Sends a NOTIFY message to the remote system Read more
source§fn create<R>(
&mut self,
rrset: R,
zone_origin: Name
) -> ClientResponse<<Self as DnsHandle>::Response>where
R: Into<RecordSet>,
fn create<R>( &mut self, rrset: R, zone_origin: Name ) -> ClientResponse<<Self as DnsHandle>::Response>where R: Into<RecordSet>,
Sends a record to create on the server, this will fail if the record exists (atomicity
depends on the server) Read more
source§fn append<R>(
&mut self,
rrset: R,
zone_origin: Name,
must_exist: bool
) -> ClientResponse<<Self as DnsHandle>::Response>where
R: Into<RecordSet>,
fn append<R>( &mut self, rrset: R, zone_origin: Name, must_exist: bool ) -> ClientResponse<<Self as DnsHandle>::Response>where R: Into<RecordSet>,
Appends a record to an existing rrset, optionally require the rrset to exist (atomicity
depends on the server) Read more
source§fn compare_and_swap<C, N>(
&mut self,
current: C,
new: N,
zone_origin: Name
) -> ClientResponse<<Self as DnsHandle>::Response>where
C: Into<RecordSet>,
N: Into<RecordSet>,
fn compare_and_swap<C, N>( &mut self, current: C, new: N, zone_origin: Name ) -> ClientResponse<<Self as DnsHandle>::Response>where C: Into<RecordSet>, N: Into<RecordSet>,
Compares and if it matches, swaps it for the new value (atomicity depends on the server) Read more
source§fn delete_by_rdata<R>(
&mut self,
rrset: R,
zone_origin: Name
) -> ClientResponse<<Self as DnsHandle>::Response>where
R: Into<RecordSet>,
fn delete_by_rdata<R>( &mut self, rrset: R, zone_origin: Name ) -> ClientResponse<<Self as DnsHandle>::Response>where R: Into<RecordSet>,
Deletes a record (by rdata) from an rrset, optionally require the rrset to exist. Read more
source§fn delete_rrset(
&mut self,
record: Record,
zone_origin: Name
) -> ClientResponse<<Self as DnsHandle>::Response>
fn delete_rrset( &mut self, record: Record, zone_origin: Name ) -> ClientResponse<<Self as DnsHandle>::Response>
Deletes an entire rrset, optionally require the rrset to exist. Read more
source§fn delete_all(
&mut self,
name_of_records: Name,
zone_origin: Name,
dns_class: DNSClass
) -> ClientResponse<<Self as DnsHandle>::Response>
fn delete_all( &mut self, name_of_records: Name, zone_origin: Name, dns_class: DNSClass ) -> ClientResponse<<Self as DnsHandle>::Response>
Deletes all records at the specified name Read more
source§fn zone_transfer(
&mut self,
zone_origin: Name,
last_soa: Option<SOA>
) -> ClientStreamXfr<<Self as DnsHandle>::Response>
fn zone_transfer( &mut self, zone_origin: Name, last_soa: Option<SOA> ) -> ClientStreamXfr<<Self as DnsHandle>::Response>
Download all records from a zone, or all records modified since given SOA was observed.
The request will either be a AXFR Query (ask for full zone transfer) if a SOA was not
provided, or a IXFR Query (incremental zone transfer) if a SOA was provided. Read more