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
impl DnsRequest
Sourcepub fn from_query(query: Query, options: DnsRequestOptions) -> Self
pub fn from_query(query: Query, options: DnsRequestOptions) -> Self
Build a new DnsRequest from a Query and DnsRequestOptions.
Sourcepub fn new(message: Message, options: DnsRequestOptions) -> Self
pub fn new(message: Message, options: DnsRequestOptions) -> Self
Returns a new DnsRequest object
Sourcepub fn with_original_query(self, original_query: Option<Query>) -> Self
pub fn with_original_query(self, original_query: Option<Query>) -> Self
Add the original query
Sourcepub fn options(&self) -> &DnsRequestOptions
pub fn options(&self) -> &DnsRequestOptions
Get the set of request options associated with this request
Sourcepub fn options_mut(&mut self) -> &mut DnsRequestOptions
pub fn options_mut(&mut self) -> &mut DnsRequestOptions
Get a mutable reference to the request options associated with this request
Sourcepub fn into_parts(self) -> (Message, DnsRequestOptions)
pub fn into_parts(self) -> (Message, DnsRequestOptions)
Unwraps the raw message
Sourcepub fn original_query(&self) -> Option<&Query>
pub fn original_query(&self) -> Option<&Query>
Get the request’s original query
Methods from Deref<Target = Message>§
Sourcepub fn truncate(&self) -> Self
pub fn truncate(&self) -> Self
Truncates a Message, this blindly removes all response fields and sets truncated to true
Sourcepub fn add_query(&mut self, query: Query) -> &mut Self
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.
Sourcepub fn add_queries<Q, I>(&mut self, queries: Q) -> &mut Self
pub fn add_queries<Q, I>(&mut self, queries: Q) -> &mut Self
Adds an iterator over a set of Queries to be added to the message
Sourcepub fn add_answer(&mut self, record: Record) -> &mut Self
pub fn add_answer(&mut self, record: Record) -> &mut Self
Add a record to the Answer section.
Sourcepub fn add_answers<R, I>(&mut self, records: R) -> &mut Self
pub fn add_answers<R, I>(&mut self, records: R) -> &mut Self
Add all the records from the iterator to the Answer section of the message.
Sourcepub fn insert_answers(&mut self, records: Vec<Record>)
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.
Add a record to the Authority section.
Add all the records from the Iterator to the Authority section of the message.
Sets the Authority section to the specified set of records.
§Panics
Will panic if the Authority section is already non-empty.
Sourcepub fn add_additional(&mut self, record: Record) -> &mut Self
pub fn add_additional(&mut self, record: Record) -> &mut Self
Add a record to the Additional section.
Sourcepub fn add_additionals<R, I>(&mut self, records: R) -> &mut Self
pub fn add_additionals<R, I>(&mut self, records: R) -> &mut Self
Add all the records from the iterator to the Additional section of the message.
Sourcepub fn insert_additionals(&mut self, records: Vec<Record>)
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.
Sourcepub fn take_all_sections(&mut self) -> impl Iterator<Item = Record>
pub fn take_all_sections(&mut self) -> impl Iterator<Item = Record>
Consume the message, returning an iterator over records from all sections
Sourcepub fn all_sections(&self) -> impl Iterator<Item = &Record>
pub fn all_sections(&self) -> impl Iterator<Item = &Record>
All sections chained
Sourcepub fn max_payload(&self) -> u16
pub fn max_payload(&self) -> u16
§Return value
the max payload value as it’s defined in the EDNS OPT pseudo-RR.
Sourcepub fn signature(&self) -> Option<&Record<TSIG>>
pub fn signature(&self) -> Option<&Record<TSIG>>
§Return value
the signature over the message, if any
Trait Implementations§
Source§impl Clone for DnsRequest
impl Clone for DnsRequest
Source§fn clone(&self) -> DnsRequest
fn clone(&self) -> DnsRequest
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Deref for DnsRequest
impl Deref for DnsRequest
Source§impl DerefMut for DnsRequest
impl DerefMut for DnsRequest
Source§impl From<Message> for DnsRequest
impl From<Message> for DnsRequest
Source§impl PartialEq for DnsRequest
impl PartialEq for DnsRequest
Source§fn eq(&self, other: &DnsRequest) -> bool
fn eq(&self, other: &DnsRequest) -> bool
self and other values to be equal, and is used by ==.