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>
pub fn from_octets(octets: Octs) -> Result<Self, LongOptData>
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> Freeze for Padding<Octs>
impl<Octs> RefUnwindSafe for Padding<Octs>where
Octs: RefUnwindSafe + ?Sized,
impl<Octs> Send for Padding<Octs>
impl<Octs> Sync for Padding<Octs>
impl<Octs> Unpin for Padding<Octs>
impl<Octs> UnwindSafe for Padding<Octs>where
Octs: UnwindSafe + ?Sized,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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) -> Target
fn octets_into(self) -> Target
Performs an infallible conversion.