pub struct ClientSubnet { /* private fields */ }
Expand description
Option data for the client subnet option.
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.
The option identifies the network through an address prefix, i.e., an IP address of which only a certain number of left-side bits is interpreted. The option uses two such numbers: The source prefix length is the number of bits provided by the client when describing its network and the scope prefix length is the number of bits that the server considered when providing the answer. The scope prefix length is zero in a query. It can be used by a caching resolver to cache multiple responses for different client subnets.
The option is defined in RFC 7871 which also includes some guidance on its use.
Implementations§
source§impl ClientSubnet
impl ClientSubnet
sourcepub fn new(
source_prefix_len: u8,
scope_prefix_len: u8,
addr: IpAddr,
) -> ClientSubnet
pub fn new( source_prefix_len: u8, scope_prefix_len: u8, addr: IpAddr, ) -> ClientSubnet
Creates a new client subnet value.
The function is very forgiving regarding the arguments and corrects illegal values. That is, it limit the prefix lengths given to a number meaningful for the address family. It will also set all bits not covered by the source prefix length in the address to zero.
sourcepub fn source_prefix_len(&self) -> u8
pub fn source_prefix_len(&self) -> u8
Returns the source prefix length.
The source prefix length is the prefix length as specified by the client in a query.
sourcepub fn scope_prefix_len(&self) -> u8
pub fn scope_prefix_len(&self) -> u8
Returns the scope prefix length.
The scope prefix length is the prefix length used by the server for its answer.
Trait Implementations§
source§impl Clone for ClientSubnet
impl Clone for ClientSubnet
source§fn clone(&self) -> ClientSubnet
fn clone(&self) -> ClientSubnet
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl ComposeOptData for ClientSubnet
impl ComposeOptData for ClientSubnet
fn compose_len(&self) -> u16
fn compose_option<Target: OctetsBuilder + ?Sized>( &self, target: &mut Target, ) -> Result<(), Target::AppendError>
source§impl Debug for ClientSubnet
impl Debug for ClientSubnet
source§impl Display for ClientSubnet
impl Display for ClientSubnet
source§impl<Octs, Name> From<ClientSubnet> for AllOptData<Octs, Name>
impl<Octs, Name> From<ClientSubnet> for AllOptData<Octs, Name>
source§fn from(value: ClientSubnet) -> Self
fn from(value: ClientSubnet) -> Self
source§impl Hash for ClientSubnet
impl Hash for ClientSubnet
source§impl OptData for ClientSubnet
impl OptData for ClientSubnet
source§fn code(&self) -> OptionCode
fn code(&self) -> OptionCode
source§impl Ord for ClientSubnet
impl Ord for ClientSubnet
source§fn cmp(&self, other: &ClientSubnet) -> Ordering
fn cmp(&self, other: &ClientSubnet) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<'a, Octs: AsRef<[u8]>> ParseOptData<'a, Octs> for ClientSubnet
impl<'a, Octs: AsRef<[u8]>> ParseOptData<'a, Octs> for ClientSubnet
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>
source§impl PartialEq for ClientSubnet
impl PartialEq for ClientSubnet
source§impl PartialOrd for ClientSubnet
impl PartialOrd for ClientSubnet
impl Copy for ClientSubnet
impl Eq for ClientSubnet
impl StructuralPartialEq for ClientSubnet
Auto Trait Implementations§
impl Freeze for ClientSubnet
impl RefUnwindSafe for ClientSubnet
impl Send for ClientSubnet
impl Sync for ClientSubnet
impl Unpin for ClientSubnet
impl UnwindSafe for ClientSubnet
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)