domain/base/iana/
svcb.rs
1use core::fmt;
4
5int_enum! {
6 =>
7 SvcParamKey, u16;
8
9 (Mandatory => 0, b"Mandatory keys in this RR")
10 (Alpn => 1, b"Additional supported protocols")
11 (NoDefaultAlpn => 2, b"Additional supported protocols")
12 (Port => 3, b"Port for alternative endpoint")
13 (Ipv4Hint => 4, b"IPv4 address hints")
14 (Ech => 5, b"Encrypted ClientHello info")
16 (Ipv6Hint => 6, b"IPv6 address hints")
17 (DohPath => 7, b"DNS over HTTPS path template")
19}
20
21pub const SVC_PARAM_KEY_PRIVATE_RANGE_BEGIN: u16 = 65280;
22pub const SVC_PARAM_KEY_PRIVATE_RANGE_END: u16 = 65534;
23pub const SVC_PARAM_KEY_INVALID: u16 = 65535;
24
25impl fmt::Display for SvcParamKey {
26 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
27 let s = match self {
28 Self::Mandatory => "mandatory",
29 Self::Alpn => "alpn",
30 Self::NoDefaultAlpn => "nodefaultalpn",
31 Self::Port => "port",
32 Self::Ipv4Hint => "ipv4hint",
33 Self::Ech => "ech",
34 Self::Ipv6Hint => "ipv6hint",
35 Self::DohPath => "dohpath",
36 Self::Int(n) => return write!(f, "key{}", n),
37 };
38
39 f.write_str(s)
40 }
41}