add support for SVCB record

This commit add initial support for SVCB and HTTPS record defined in
[draft-ietf-dnsop-svcb-https][1]. It includes basic interaction with
the rdata, convert from/to the wire format.

[1]: https://datatracker.ietf.org/doc/draft-ietf-dnsop-svcb-https/
This commit is contained in:
Anbang Wen
2021-10-22 00:25:24 -07:00
parent 3d5816596e
commit b6676abaec
5 changed files with 1425 additions and 0 deletions
+2
View File
@@ -34,6 +34,7 @@ pub use self::opt::OptionCode;
pub use self::rcode::{OptRcode, Rcode, TsigRcode};
pub use self::rtype::Rtype;
pub use self::secalg::SecAlg;
pub use self::svcb::SvcbParamKey;
#[macro_use]
mod macros;
@@ -47,3 +48,4 @@ pub mod opt;
pub mod rcode;
pub mod rtype;
pub mod secalg;
pub mod svcb;
+10
View File
@@ -299,6 +299,16 @@ int_enum! {
/// See draft-wessels-dns-zone-digest.
(Zonemd => 63, b"ZONEMD")
/// General Purpose Service Endpoints.
///
/// See draft-ietf-dnsop-svcb-httpssvc
(Svcb => 64, b"SVCB")
/// HTTPS Specific Service Endpoints.
///
/// See draft-ietf-dnsop-svcb-httpssvc
(Https => 65, b"HTTPS")
/// SPF.
///
/// RFC 7208.
+43
View File
@@ -0,0 +1,43 @@
//! Service Binding (SVCB) Parameter Registry
use core::fmt;
//------------ Service Binding Parameters -----------
int_enum! {
=>
SvcbParamKey, u16;
(Mandatory => 0, b"Mandatory keys in this RR")
(Alpn => 1, b"Additional supported protocols")
(NoDefaultAlpn => 2, b"Additional supported protocols")
(Port => 3, b"Port for alternative endpoint")
(Ipv4Hint => 4, b"IPv4 address hints")
// https://datatracker.ietf.org/doc/draft-ietf-tls-esni/
(Ech => 5, b"Encrypted ClientHello info")
(Ipv6Hint => 6, b"IPv6 address hints")
// https://datatracker.ietf.org/doc/draft-ietf-add-svcb-dns/
(DohPath => 7, b"DNS over HTTPS path template")
}
pub const SVCB_PARAM_KEY_PRIVATE_RANGE_BEGIN: u16 = 65280;
pub const SVCB_PARAM_KEY_PRIVATE_RANGE_END: u16 = 65534;
pub const SVCB_PARAM_KEY_INVALID: u16 = 65535;
impl fmt::Display for SvcbParamKey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let s = match self {
Self::Mandatory => "mandatory",
Self::Alpn => "alpn",
Self::NoDefaultAlpn => "nodefaultalpn",
Self::Port => "port",
Self::Ipv4Hint => "ipv4hint",
Self::Ech => "ech",
Self::Ipv6Hint => "ipv6hint",
Self::DohPath => "dohpath",
Self::Int(n) => return write!(f, "key{}", n),
};
f.write_str(s)
}
}
+7
View File
@@ -35,6 +35,7 @@ pub mod rfc4034;
pub mod rfc5155;
pub mod rfc6672;
pub mod rfc7344;
pub mod svcb;
// The rdata_types! macro (defined in self::macros) re-exports the record data
// types here and creates the ZoneRecordData and AllRecordData enums
@@ -113,4 +114,10 @@ rdata_types! {
Cds<O>,
}
}
svcb::{
pseudo {
Svcb<O, N>,
Https<O, N>,
}
}
}
+1363
View File
File diff suppressed because it is too large Load Diff