Skip to main content

EdnsOption

Enum EdnsOption 

Source
pub enum EdnsOption {
    NSID(Vec<u8>),
    DAU(Vec<u8>),
    DHU(Vec<u8>),
    N3U(Vec<u8>),
    ClientSubnet {
        family: u16,
        source_prefix: u8,
        scope_prefix: u8,
        address: Vec<u8>,
    },
    Cookie {
        client: Vec<u8>,
        server: Vec<u8>,
    },
    ExtendedDnsError {
        info_code: u16,
        extra_text: String,
    },
    Owner {
        version: u8,
        seq: u8,
        primary_mac: MacAddress,
    },
    Unknown {
        code: u16,
        data: Vec<u8>,
    },
}
Expand description

EDNS0 option parsed from OPT record RDATA.

Variants§

§

NSID(Vec<u8>)

NSID - Name Server Identifier (RFC 5001)

§

DAU(Vec<u8>)

DAU - DNSSEC Algorithm Understood (RFC 6975)

§

DHU(Vec<u8>)

DHU - DS Hash Understood (RFC 6975)

§

N3U(Vec<u8>)

N3U - NSEC3 Hash Understood (RFC 6975)

§

ClientSubnet

Client Subnet (RFC 7871)

Fields

§family: u16
§source_prefix: u8
§scope_prefix: u8
§address: Vec<u8>
§

Cookie

DNS Cookie (RFC 7873)

Fields

§client: Vec<u8>
§server: Vec<u8>
§

ExtendedDnsError

Extended DNS Error (RFC 8914)

Fields

§info_code: u16
§extra_text: String
§

Owner

Owner option (Apple mDNS)

Fields

§version: u8
§seq: u8
§primary_mac: MacAddress
§

Unknown

Unknown/unsupported option

Fields

§code: u16
§data: Vec<u8>

Implementations§

Source§

impl EdnsOption

Source

pub fn parse(code: u16, data: &[u8]) -> Result<Self, FieldError>

Parse a single EDNS0 option from wire format. data contains the option data (after code and length).

Source

pub fn code(&self) -> u16

Get the option code for this EDNS0 option.

Source

pub fn build_data(&self) -> Vec<u8>

Serialize the option data (without the code and length header).

Source

pub fn build(&self) -> Vec<u8>

Build the complete TLV (code + length + data).

Source

pub fn parse_all(data: &[u8]) -> Result<Vec<Self>, FieldError>

Parse all EDNS0 options from the OPT record RDATA.

Source

pub fn summary(&self) -> String

Summary string for display.

Trait Implementations§

Source§

impl Clone for EdnsOption

Source§

fn clone(&self) -> EdnsOption

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for EdnsOption

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for EdnsOption

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · 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 StructuralPartialEq for EdnsOption

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, 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<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V