The RR types are now supported by many server implementations including BIND, unbound, PowerDNS, and Knot DNS. Major browsers such as Chrome, Edge, and Safari have started to query HTTPS records, with the records gradually adopted by websites. Also, SVCB is actually deployed in the public DNS resolvers such as Cloudflare DNS and Google Public DNS for DDR.
With such wide adoption, we have plenty of real-world use cases, and it is unlikely the wire format will change further in an incompatible way. It is time to implement them in the client libraries!
Rationale for proposed API
Resolv::DNS::Resource::IN::ServiceBinding
This is an abstract class for SVCB-compatible RR types. SVCB-compatible RR types, as defined in the Draft, shares the wire format and the semantics of their RDATA fields with SVCB to allow implementations to share the processing of these RR types. So we do so.
The interface of this class is straightforward: It has three attributes priority, target, and params, which correspond the RDATA fields SvcPriority, TargetName, and SvcParams, resp.
SVCB RR type is defined specifically within IN class. Thus, this class is placed in the Resolv::DNS::Resource::IN namespace.
This class represents a pair of a SvcParamKey and a SvcParamValue. Aligned with the design of Resolv::DNS::Resource, each SvcParamKey has its own subclass of Resolv::DNS::SvcParam.
Resolv::DNS::SvcParam::Generic
This is an abstract class representing a SvcParamKey that is unknown to this library. Generic.create(key) dynamically defines its
subclass for specific key. E.g., Generic.create(667) will define Generic::Key667.
This class holds SvcParamValue in its wire format.
SvcParam with an unknown SvcParamKey will be decoded as a subclass of this class. Also, users of this library can generate a non-supported SvcParam if they know its wire format.
Resolv::DNS::SvcParams
This is conceptually a set of SvcParams, whose elements have the unique SvcParamKeys. It behaves like a set, and for convenience provides indexing by SvcParamKey.
#initialize(params) takes an Enumerable of SvcParams as the initial content. If it contains SvcParams with the duplicate key, the one that appears last takes precedence.
#[](key) fetches the SvcParam with the given key. The key can be specified by its name (e.g., :alpn) or number (e.g., 1).
#add(param) adds a SvcParam to the set. If the set already has a SvcParam with the same key, it will be replaced.
#delete(key) deletes a SvcParam by its key and returns it. The key can be specified by its name or number.
This patch implements SVCB and HTTPS resource record types defined in draft-ietf-dnsop-svcb-https-12.
The RR types are now supported by many server implementations including BIND, unbound, PowerDNS, and Knot DNS. Major browsers such as Chrome, Edge, and Safari have started to query HTTPS records, with the records gradually adopted by websites. Also, SVCB is actually deployed in the public DNS resolvers such as Cloudflare DNS and Google Public DNS for DDR.
With such wide adoption, we have plenty of real-world use cases, and it is unlikely the wire format will change further in an incompatible way. It is time to implement them in the client libraries!
Rationale for proposed API
Resolv::DNS::Resource::IN::ServiceBinding
This is an abstract class for SVCB-compatible RR types. SVCB-compatible RR types, as defined in the Draft, shares the wire format and the semantics of their RDATA fields with SVCB to allow implementations to share the processing of these RR types. So we do so.
The interface of this class is straightforward: It has three attributes
priority
,target
, andparams
, which correspond the RDATA fields SvcPriority, TargetName, and SvcParams, resp.SVCB RR type is defined specifically within IN class. Thus, this class is placed in the
Resolv::DNS::Resource::IN
namespace.Resolv::DNS::Resource::IN::SVCB
,Resolv::DNS::Resource::IN::HTTPS
Just inherits ServiceBinding class.
Resolv::DNS::SvcParam
This class represents a pair of a SvcParamKey and a SvcParamValue. Aligned with the design of
Resolv::DNS::Resource
, each SvcParamKey has its own subclass ofResolv::DNS::SvcParam
.Resolv::DNS::SvcParam::Generic
This is an abstract class representing a SvcParamKey that is unknown to this library.
Generic.create(key)
dynamically defines its subclass for specifickey
. E.g.,Generic.create(667)
will defineGeneric::Key667
.This class holds SvcParamValue in its wire format.
SvcParam with an unknown SvcParamKey will be decoded as a subclass of this class. Also, users of this library can generate a non-supported SvcParam if they know its wire format.
Resolv::DNS::SvcParams
This is conceptually a set of
SvcParam
s, whose elements have the unique SvcParamKeys. It behaves like a set, and for convenience provides indexing by SvcParamKey.#initialize(params)
takes an Enumerable ofSvcParam
s as the initial content. If it containsSvcParam
s with the duplicate key, the one that appears last takes precedence.#[](key)
fetches theSvcParam
with the given key. The key can be specified by its name (e.g.,:alpn
) or number (e.g.,1
).#add(param)
adds aSvcParam
to the set. If the set already has aSvcParam
with the same key, it will be replaced.#delete(key)
deletes aSvcParam
by its key and returns it. The key can be specified by its name or number.Actually working in real world: