pub struct Padding<Octs: ?Sized> { /* private fields */ }
Expand description
Option data for the padding option.
This option is used to increase the size of a DNS message to a fixed value so eavesdropper can’t dertermine information from the size.
Generally, you should not need to use this type. Instead, you can use
the OptBuilder::padding
and OptBuilder::random_padding
methods to
add padding to a message – and ignore it when receving one.
The option is defined in RFC 7830.
Implementations§
source§impl<Octs> Padding<Octs>
impl<Octs> Padding<Octs>
sourcepub fn from_octets(octets: Octs) -> Result<Self, LongOptData>where
Octs: AsRef<[u8]>,
pub fn from_octets(octets: Octs) -> Result<Self, LongOptData>where Octs: AsRef<[u8]>,
Creates a value from the padding octets.
Returns an error if octets
are longer than 65,535 octets.
sourcepub unsafe fn from_octets_unchecked(octets: Octs) -> Self
pub unsafe fn from_octets_unchecked(octets: Octs) -> Self
Creates a value from the padding octets without checking.
Safety
The caller needs to ensure that octets
are not longer than
65,535 octets.
Trait Implementations§
source§impl<Octs: AsRef<[u8]>> ComposeOptData for Padding<Octs>
impl<Octs: AsRef<[u8]>> ComposeOptData for Padding<Octs>
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target ) -> Result<(), Target::AppendError>
source§impl<Octs, Name> From<Padding<Octs>> for AllOptData<Octs, Name>
impl<Octs, Name> From<Padding<Octs>> for AllOptData<Octs, Name>
source§impl<Octs> OptData for Padding<Octs>
impl<Octs> OptData for Padding<Octs>
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
Returns the option code associated with this option.
source§impl<'a, Octs: Octets> ParseOptData<'a, Octs> for Padding<Octs::Range<'a>>
impl<'a, Octs: Octets> ParseOptData<'a, Octs> for Padding<Octs::Range<'a>>
source§fn parse_option(
code: OptionCode,
parser: &mut Parser<'a, Octs>
) -> Result<Option<Self>, ParseError>
fn parse_option( code: OptionCode, parser: &mut Parser<'a, Octs> ) -> Result<Option<Self>, ParseError>
Parses the option code data. Read more
impl<Octs: Copy + ?Sized> Copy for Padding<Octs>
Auto Trait Implementations§
impl<Octs: ?Sized> RefUnwindSafe for Padding<Octs>where Octs: RefUnwindSafe,
impl<Octs: ?Sized> Send for Padding<Octs>where Octs: Send,
impl<Octs: ?Sized> Sync for Padding<Octs>where Octs: Sync,
impl<Octs: ?Sized> Unpin for Padding<Octs>where Octs: Unpin,
impl<Octs: ?Sized> UnwindSafe for Padding<Octs>where Octs: UnwindSafe,
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<Source, Target> OctetsInto<Target> for Sourcewhere
Target: OctetsFrom<Source>,
impl<Source, Target> OctetsInto<Target> for Sourcewhere Target: OctetsFrom<Source>,
type Error = <Target as OctetsFrom<Source>>::Error
source§fn try_octets_into(
self
) -> Result<Target, <Source as OctetsInto<Target>>::Error>
fn try_octets_into( self ) -> Result<Target, <Source as OctetsInto<Target>>::Error>
Performs the conversion.
source§fn octets_into(self) -> Targetwhere
Self::Error: Into<Infallible>,
fn octets_into(self) -> Targetwhere Self::Error: Into<Infallible>,
Performs an infallible conversion.