Skip to content

Commit 9e38cd1

Browse files
committed
dns: add resolveSvcb() and resolveHttps()
Add support for the SVCB and HTTPS service binding records defined in RFC 9460 through dns.resolveSvcb(), dns.resolveHttps(), the matching Resolver and dns.promises methods, the 'SVCB' and 'HTTPS' rrtypes for dns.resolve(), and dns.resolveAny(). Known SvcParams (mandatory, alpn, no-default-alpn, port, ipv4hint, ech, ipv6hint, dohpath and ohttp) are decoded. All other keys, including private-use keys, are returned as keyNNNNN with the raw value as an ArrayBuffer. SvcParams on AliasMode records are ignored. Records with malformed SvcParams fail resolveSvcb() and resolveHttps() with EBADRESP and are dropped from resolveAny() results. Refs: #38173 Refs: #64280 Signed-off-by: Ingmar Van Glabbeek <ivanglabbeek@infoblox.com>
1 parent c9b3082 commit 9e38cd1

13 files changed

Lines changed: 779 additions & 0 deletions

‎doc/api/dns.md‎

Lines changed: 158 additions & 0 deletions
Large diffs are not rendered by default.

‎lib/internal/dns/utils.js‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,12 +246,14 @@ const resolverKeys = [
246246
'resolveAny',
247247
'resolveCaa',
248248
'resolveCname',
249+
'resolveHttps',
249250
'resolveMx',
250251
'resolveNaptr',
251252
'resolveNs',
252253
'resolvePtr',
253254
'resolveSoa',
254255
'resolveSrv',
256+
'resolveSvcb',
255257
'resolveTlsa',
256258
'resolveTxt',
257259
'reverse',
@@ -303,11 +305,13 @@ function createResolverClass(resolver) {
303305
Resolver.prototype.resolve6 = resolveMap.AAAA = resolver('queryAaaa');
304306
Resolver.prototype.resolveCaa = resolveMap.CAA = resolver('queryCaa');
305307
Resolver.prototype.resolveCname = resolveMap.CNAME = resolver('queryCname');
308+
Resolver.prototype.resolveHttps = resolveMap.HTTPS = resolver('queryHttps');
306309
Resolver.prototype.resolveMx = resolveMap.MX = resolver('queryMx');
307310
Resolver.prototype.resolveNs = resolveMap.NS = resolver('queryNs');
308311
Resolver.prototype.resolveTlsa = resolveMap.TLSA = resolver('queryTlsa');
309312
Resolver.prototype.resolveTxt = resolveMap.TXT = resolver('queryTxt');
310313
Resolver.prototype.resolveSrv = resolveMap.SRV = resolver('querySrv');
314+
Resolver.prototype.resolveSvcb = resolveMap.SVCB = resolver('querySvcb');
311315
Resolver.prototype.resolvePtr = resolveMap.PTR = resolver('queryPtr');
312316
Resolver.prototype.resolveNaptr = resolveMap.NAPTR = resolver('queryNaptr');
313317
Resolver.prototype.resolveSoa = resolveMap.SOA = resolver('querySoa');

0 commit comments

Comments
 (0)