pub struct Client<P> { /* 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<P: RuntimeProvider> Client<P>
impl<P: RuntimeProvider> Client<P>
Sourcepub fn new<S: DnsClientStream>(
stream: S,
stream_handle: BufDnsStreamHandle,
) -> (Self, DnsExchangeBackground<DnsMultiplexer<S>, P::Timer>)
pub fn new<S: DnsClientStream>( stream: S, stream_handle: BufDnsStreamHandle, ) -> (Self, DnsExchangeBackground<DnsMultiplexer<S>, P::Timer>)
Spawns a new Client 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.
Sourcepub fn with_timeout<S: DnsClientStream>(
stream: S,
stream_handle: BufDnsStreamHandle,
timeout_duration: Duration,
) -> (Self, DnsExchangeBackground<DnsMultiplexer<S>, P::Timer>)
pub fn with_timeout<S: DnsClientStream>( stream: S, stream_handle: BufDnsStreamHandle, timeout_duration: Duration, ) -> (Self, DnsExchangeBackground<DnsMultiplexer<S>, P::Timer>)
Spawns a new Client Stream.
§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.timeout_duration- All requests may fail due to lack of response, this is the time to wait for a response before canceling the request.
Sourcepub fn from_sender<S: DnsRequestSender>(
sender: S,
) -> (Self, DnsExchangeBackground<S, P::Timer>)
pub fn from_sender<S: DnsRequestSender>( sender: S, ) -> (Self, DnsExchangeBackground<S, P::Timer>)
Creates a Client from an existing DnsRequestSender
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<P: RuntimeProvider> DnsHandle for Client<P>
impl<P: RuntimeProvider> DnsHandle for Client<P>
Source§type Response = DnsExchangeSend<P>
type Response = DnsExchangeSend<P>
The associated response from the response stream, this should resolve to the Response messages
Source§fn send(&self, request: DnsRequest) -> Self::Response
fn send(&self, request: DnsRequest) -> 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<P> Freeze for Client<P>
impl<P> !RefUnwindSafe for Client<P>
impl<P> Send for Client<P>where
P: Send,
impl<P> Sync for Client<P>where
P: Sync,
impl<P> Unpin for Client<P>where
P: Unpin,
impl<P> UnsafeUnpin for Client<P>
impl<P> !UnwindSafe for Client<P>
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,
impl<T> ClientHandle for Twhere
T: DnsHandle,
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> ⓘ
fn notify<R>( &mut self, name: Name, query_class: DNSClass, query_type: RecordType, rrset: Option<R>, ) -> ClientResponse<<Self as DnsHandle>::Response> ⓘ
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> ⓘ
fn create<R>( &mut self, rrset: R, zone_origin: Name, ) -> ClientResponse<<Self as DnsHandle>::Response> ⓘ
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> ⓘ
fn append<R>( &mut self, rrset: R, zone_origin: Name, must_exist: bool, ) -> ClientResponse<<Self as DnsHandle>::Response> ⓘ
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> ⓘ
fn compare_and_swap<C, N>( &mut self, current: C, new: N, zone_origin: Name, ) -> ClientResponse<<Self as DnsHandle>::Response> ⓘ
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> ⓘ
fn delete_by_rdata<R>( &mut self, rrset: R, zone_origin: Name, ) -> ClientResponse<<Self as DnsHandle>::Response> ⓘ
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more