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 more