mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
[ruby/resolv] Implement dohpath SvcParam
(https://github.com/ruby/resolv/pull/33)
* Implement dohpath SvcParam [RFC 9461]
This patch implements "dohpath" SvcParam proposed in
[draft-ietf-add-svcb-dns-08]. This parameter specifies a URI template
for the :path used in DNS-over-HTTPS requests.
"dohpath" is employed by [DDR], also a to-be-published Proposed Standard
that specifies how to upgrade DNS transport to a more secure one, i.d.,
DNS-over-TLS or DNS-over-HTTPS. DDR is deployed in the public DNS
resolvers including Cloudflare DNS, Google Public DNS, and Quad9.
[RFC 9461]: https://datatracker.ietf.org/doc/rfc9461/
[DDR]: https://datatracker.ietf.org/doc/draft-ietf-add-ddr/
da9c023539
Co-authored-by: Sorah Fukumori <her@sorah.jp>
This commit is contained in:
parent
608a518b42
commit
e3b485213d
2 changed files with 57 additions and 1 deletions
|
@ -2027,6 +2027,35 @@ class Resolv
|
|||
end
|
||||
end
|
||||
|
||||
##
|
||||
# "dohpath" SvcParam -- DNS over HTTPS path template [RFC9461]
|
||||
|
||||
class DoHPath < SvcParam
|
||||
KeyName = :dohpath
|
||||
KeyNumber = 7
|
||||
ClassHash[KeyName] = ClassHash[KeyNumber] = self # :nodoc:
|
||||
|
||||
##
|
||||
# URI template for DoH queries.
|
||||
|
||||
attr_reader :template
|
||||
|
||||
##
|
||||
# Initialize "dohpath" ScvParam.
|
||||
|
||||
def initialize(template)
|
||||
@template = template.encode('utf-8')
|
||||
end
|
||||
|
||||
def encode(msg) # :nodoc:
|
||||
msg.put_bytes(@template)
|
||||
end
|
||||
|
||||
def self.decode(msg) # :nodoc:
|
||||
template = msg.get_bytes.force_encoding('utf-8')
|
||||
return self.new(template)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue