pub struct Opt<Octs: ?Sized> { /* private fields */ }
Expand description
OPT record data.
This is the record data type for OPT records and can be used as the data
type parameter in Record
. It simply wraps an octets sequence with all
the record data. It guarantees that the data contains a correctly
formatted sequence of options but doesn’t guarantee that the options
themselves are correct. You can iterate over options via the iter
method.
Since some of the information of the OPT record is transmitted in the
record header, a special type OptRecord
exists, that contains all
the OPT data which is the preferred way of accessing this data.
Implementations§
source§impl<Octs: Octets> Opt<Octs>
impl<Octs: Octets> Opt<Octs>
sourcepub fn dau(&self) -> Option<Dau<Octs::Range<'_>>>
pub fn dau(&self) -> Option<Dau<Octs::Range<'_>>>
Returns the first DAU option if present.
This option lists the DNSSEC signature algorithms the requester supports.
source§impl<Octs: Octets> Opt<Octs>
impl<Octs: Octets> Opt<Octs>
sourcepub fn extended_error(&self) -> Option<ExtendedError<Octs::Range<'_>>>
pub fn extended_error(&self) -> Option<ExtendedError<Octs::Range<'_>>>
Returns the first extended DNS error option if present.
The extended DNS error option carries additional error information in a failed answer.
source§impl<Octs: Octets> Opt<Octs>
impl<Octs: Octets> Opt<Octs>
sourcepub fn tcp_keepalive(&self) -> Option<TcpKeepalive>
pub fn tcp_keepalive(&self) -> Option<TcpKeepalive>
Returns the first edns-tcp-keepalive option if present.
This option is used to signal a timeout to keep a TCP connection open.
source§impl<Octs: Octets> Opt<Octs>
impl<Octs: Octets> Opt<Octs>
sourcepub fn client_subnet(&self) -> Option<ClientSubnet>
pub fn client_subnet(&self) -> Option<ClientSubnet>
Returns the first client subnet option if present.
This option allows a resolver to include information about the network a query originated from. This information can then be used by an authoritative server to provide the best response for this network.
source§impl<Octs: AsRef<[u8]>> Opt<Octs>
impl<Octs: AsRef<[u8]>> Opt<Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, ParseError>
pub fn from_octets(octets: Octs) -> Result<Self, ParseError>
Creates OPT record data from an octets sequence.
The function checks whether the octets contain a sequence of options. It does not check whether the options themselves are valid.
source§impl Opt<[u8]>
impl Opt<[u8]>
sourcepub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
pub fn from_slice(slice: &[u8]) -> Result<&Self, ParseError>
Creates OPT record data from an octets slice.
source§impl<Octs: AsRef<[u8]> + ?Sized> Opt<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> Opt<Octs>
sourcepub fn iter<'s, Data>(&'s self) -> OptIter<'s, Octs, Data> ⓘwhere
Octs: Octets,
Data: ParseOptData<'s, Octs>,
pub fn iter<'s, Data>(&'s self) -> OptIter<'s, Octs, Data> ⓘwhere
Octs: Octets,
Data: ParseOptData<'s, Octs>,
Returns an iterator over options of a given type.
The returned iterator will return only options represented by type
D
and quietly skip over all the others.
sourcepub fn first<'s, Data>(&'s self) -> Option<Data>where
Octs: Octets,
Data: ParseOptData<'s, Octs>,
pub fn first<'s, Data>(&'s self) -> Option<Data>where
Octs: Octets,
Data: ParseOptData<'s, Octs>,
Returns the first option of a given type if present.
If trying to parse this first option fails, returns None
as well.
Trait Implementations§
source§impl<Octs: AsRef<[u8]> + ?Sized> ComposeRecordData for Opt<Octs>
impl<Octs: AsRef<[u8]> + ?Sized> ComposeRecordData for Opt<Octs>
source§fn rdlen(&self, _compress: bool) -> Option<u16>
fn rdlen(&self, _compress: bool) -> Option<u16>
source§fn compose_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.source§fn compose_canonical_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
target
.source§fn compose_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§fn compose_canonical_len_rdata<Target: Composer + ?Sized>(
&self,
target: &mut Target,
) -> Result<(), Target::AppendError>
fn compose_canonical_len_rdata<Target: Composer + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl<O, N> From<Opt<O>> for AllRecordData<O, N>
impl<O, N> From<Opt<O>> for AllRecordData<O, N>
source§impl<Octs, SrcOcts> OctetsFrom<Opt<SrcOcts>> for Opt<Octs>where
Octs: OctetsFrom<SrcOcts>,
impl<Octs, SrcOcts> OctetsFrom<Opt<SrcOcts>> for Opt<Octs>where
Octs: OctetsFrom<SrcOcts>,
type Error = <Octs as OctetsFrom<SrcOcts>>::Error
source§impl<'a, Octs> ParseRecordData<'a, Octs> for Opt<Octs::Range<'a>>
impl<'a, Octs> ParseRecordData<'a, Octs> for Opt<Octs::Range<'a>>
source§fn parse_rdata(
rtype: Rtype,
parser: &mut Parser<'a, Octs>,
) -> Result<Option<Self>, ParseError>
fn parse_rdata( rtype: Rtype, parser: &mut Parser<'a, Octs>, ) -> Result<Option<Self>, ParseError>
source§impl<Octs, Other> PartialEq<Opt<Other>> for Opt<Octs>
impl<Octs, Other> PartialEq<Opt<Other>> for Opt<Octs>
source§impl<Octs, Other> PartialOrd<Opt<Other>> for Opt<Octs>
impl<Octs, Other> PartialOrd<Opt<Other>> for Opt<Octs>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more