Struct simple_dns::rdata::SVCB
source · pub struct SVCB<'a> {
pub priority: u16,
pub target: Name<'a>,
/* private fields */
}
Expand description
The SVCB DNS RR type is used to locate alternative endpoints for a service. RFC 9460.
Fields§
§priority: u16
The priority of this record (relative to others, with lower values preferred).
A value of 0 indicates AliasMode.
target: Name<'a>
The domain name of either the alias target (for AliasMode) or the alternative endpoint (for ServiceMode).
Implementations§
source§impl<'a> SVCB<'a>
impl<'a> SVCB<'a>
sourcepub const NO_DEFAULT_ALPN: u16 = 2u16
pub const NO_DEFAULT_ALPN: u16 = 2u16
No support for default protocol.
sourcepub fn new(priority: u16, target: Name<'a>) -> Self
pub fn new(priority: u16, target: Name<'a>) -> Self
Creates a new SVCB
instance with no parameters.
sourcepub fn set_param<V: Into<Cow<'a, [u8]>>>(
&mut self,
key: u16,
value: V
) -> Result<()>
pub fn set_param<V: Into<Cow<'a, [u8]>>>( &mut self, key: u16, value: V ) -> Result<()>
Sets an arbitrary key=value parameter.
The format of value
is not checked against the key
.
If a parameter of the given key
already existed, the previous entry will be replaced.
sourcepub fn set_mandatory<I: IntoIterator<Item = u16>>(
&mut self,
keys: I
) -> Result<()>
pub fn set_mandatory<I: IntoIterator<Item = u16>>( &mut self, keys: I ) -> Result<()>
Sets the “mandatory” parameter.
The keys
MUST not be empty and already in strictly increasing order.
sourcepub fn set_alpn<'cs, I: IntoIterator<Item = CharacterString<'cs>>>(
&mut self,
alpn_ids: I
) -> Result<()>
pub fn set_alpn<'cs, I: IntoIterator<Item = CharacterString<'cs>>>( &mut self, alpn_ids: I ) -> Result<()>
Sets the “alpn” parameter.
The alpn_ids
MUST not be empty.
sourcepub fn set_no_default_alpn(&mut self)
pub fn set_no_default_alpn(&mut self)
Sets the “no-default-alpn” parameter.
sourcepub fn set_ipv4hint<I: IntoIterator<Item = u32>>(
&mut self,
ips: I
) -> Result<()>
pub fn set_ipv4hint<I: IntoIterator<Item = u32>>( &mut self, ips: I ) -> Result<()>
Sets the “ipv4hint” parameter.
The ips
MUST not be empty.
sourcepub fn set_ipv6hint<I: IntoIterator<Item = u128>>(
&mut self,
ips: I
) -> Result<()>
pub fn set_ipv6hint<I: IntoIterator<Item = u128>>( &mut self, ips: I ) -> Result<()>
Sets the “ipv6hint” parameter.
The ips
MUST not be empty.
sourcepub fn get_param(&self, key: u16) -> Option<&[u8]>
pub fn get_param(&self, key: u16) -> Option<&[u8]>
Gets a read-only reference to the SvcParamValue of a given key in wire format.
Returns None
if the key does not exist.
sourcepub fn iter_params(&self) -> impl Iterator<Item = (u16, &[u8])>
pub fn iter_params(&self) -> impl Iterator<Item = (u16, &[u8])>
Iterates over all parameters.
sourcepub fn into_owned<'b>(self) -> SVCB<'b>
pub fn into_owned<'b>(self) -> SVCB<'b>
Transforms the inner data into its owned type