-
Notifications
You must be signed in to change notification settings - Fork 33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement SVCB and HTTPS RRs #32
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This method repeats yielding until all the data upto the current limit is consumed, and then returns an Array containig the block results.
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`, 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. ## `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 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 `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 of `SvcParam`s as the initial content. If it contains `SvcParam`s 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. [draft-ietf-dnsop-svcb-https-12]: https://datatracker.ietf.org/doc/draft-ietf-dnsop-svcb-https/12/ [DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/
sorah
approved these changes
Nov 22, 2023
The draft now published as: https://datatracker.ietf.org/doc/rfc9460/ |
Just pushed a patch that updates the references to the RFC. |
matzbot
pushed a commit
to ruby/ruby
that referenced
this pull request
Nov 24, 2023
(ruby/resolv#32) * Add MessageDecoder#get_list This method repeats yielding until all the data upto the current limit is consumed, and then returns an Array containig the block results. * Implement SVCB and HTTPS RRs [RFC 9460] > This patch implements SVCB and HTTPS resource record types defined in > [RFC 9460]. > > 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. > > ## `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 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 `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 of `SvcParam`s as the > initial content. If it contains `SvcParam`s 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. * Update comments referring to draft-ietf-dnsop-svcb-https-12 Published as RFC 9460. https://datatracker.ietf.org/doc/rfc9460/ [draft-ietf-dnsop-svcb-https-12]: https://datatracker.ietf.org/doc/draft-ietf-dnsop-svcb-https/12/ [RFC 9460]: https://datatracker.ietf.org/doc/rfc9460/ [DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/ ruby/resolv@b3ced7f039
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 itssubclass for specific
key
. 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: