Skip to main content

DnsRequest

Struct DnsRequest 

Source
pub struct DnsRequest { /* private fields */ }
Expand description

A DNS request object

This wraps a DNS Message for requests. It also has request options associated for controlling certain features of the DNS protocol handlers.

Implementations§

Source§

impl DnsRequest

Source

pub fn from_query(query: Query, options: DnsRequestOptions) -> Self

Build a new DnsRequest from a Query and DnsRequestOptions.

Source

pub fn new(message: Message, options: DnsRequestOptions) -> Self

Returns a new DnsRequest object

Source

pub fn with_original_query(self, original_query: Option<Query>) -> Self

Add the original query

Source

pub fn options(&self) -> &DnsRequestOptions

Get the set of request options associated with this request

Source

pub fn options_mut(&mut self) -> &mut DnsRequestOptions

Get a mutable reference to the request options associated with this request

Source

pub fn into_parts(self) -> (Message, DnsRequestOptions)

Unwraps the raw message

Source

pub fn original_query(&self) -> Option<&Query>

Get the request’s original query

Methods from Deref<Target = Message>§

Source

pub fn truncate(&self) -> Self

Truncates a Message, this blindly removes all response fields and sets truncated to true

Source

pub fn add_query(&mut self, query: Query) -> &mut Self

Add a query to the Message, either the query response from the server, or the request Query.

Source

pub fn add_queries<Q, I>(&mut self, queries: Q) -> &mut Self
where Q: IntoIterator<Item = Query, IntoIter = I>, I: Iterator<Item = Query>,

Adds an iterator over a set of Queries to be added to the message

Source

pub fn add_answer(&mut self, record: Record) -> &mut Self

Add a record to the Answer section.

Source

pub fn add_answers<R, I>(&mut self, records: R) -> &mut Self
where R: IntoIterator<Item = Record, IntoIter = I>, I: Iterator<Item = Record>,

Add all the records from the iterator to the Answer section of the message.

Source

pub fn insert_answers(&mut self, records: Vec<Record>)

Sets the Answer section to the specified set of records.

§Panics

Will panic if the Answer section is already non-empty.

Source

pub fn add_authority(&mut self, record: Record) -> &mut Self

Add a record to the Authority section.

Source

pub fn add_authorities<R, I>(&mut self, records: R) -> &mut Self
where R: IntoIterator<Item = Record, IntoIter = I>, I: Iterator<Item = Record>,

Add all the records from the Iterator to the Authority section of the message.

Source

pub fn insert_authorities(&mut self, records: Vec<Record>)

Sets the Authority section to the specified set of records.

§Panics

Will panic if the Authority section is already non-empty.

Source

pub fn add_additional(&mut self, record: Record) -> &mut Self

Add a record to the Additional section.

Source

pub fn add_additionals<R, I>(&mut self, records: R) -> &mut Self
where R: IntoIterator<Item = Record, IntoIter = I>, I: Iterator<Item = Record>,

Add all the records from the iterator to the Additional section of the message.

Source

pub fn insert_additionals(&mut self, records: Vec<Record>)

Sets the Additional to the specified set of records.

§Panics

Will panic if additional records are already associated to the message.

Source

pub fn set_edns(&mut self, edns: Edns) -> &mut Self

Add the EDNS OPT pseudo-RR to the Message

Source

pub fn take_all_sections(&mut self) -> impl Iterator<Item = Record>

Consume the message, returning an iterator over records from all sections

Source

pub fn all_sections(&self) -> impl Iterator<Item = &Record>

All sections chained

Source

pub fn max_payload(&self) -> u16

§Return value

the max payload value as it’s defined in the EDNS OPT pseudo-RR.

Source

pub fn version(&self) -> u8

§Return value

the version as defined in the EDNS record

Source

pub fn signature(&self) -> Option<&Record<TSIG>>

§Return value

the signature over the message, if any

Source

pub fn take_signature(&mut self) -> Option<Box<Record<TSIG>>>

Remove signatures from the Message

Source

pub fn to_vec(&self) -> Result<Vec<u8>, ProtoError>

Encodes the Message into a buffer

Methods from Deref<Target = Metadata>§

Source

pub fn flags(&self) -> Flags

A method to get all header flags (useful for Display purposes)

Trait Implementations§

Source§

impl Clone for DnsRequest

Source§

fn clone(&self) -> DnsRequest

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Deref for DnsRequest

Source§

type Target = Message

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl DerefMut for DnsRequest

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl From<Message> for DnsRequest

Source§

fn from(message: Message) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for DnsRequest

Source§

fn eq(&self, other: &DnsRequest) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for DnsRequest

Source§

impl StructuralPartialEq for DnsRequest

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more