Skip to content

Commit b9f90fd

Browse files
cburwellTrott
authored andcommitted
doc: document the test/common/dns module
Added requested documentation for the dns.js module. Also fixed a typo. PR-URL: #15772 Fixes: #15596 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent fa265a2 commit b9f90fd

File tree

1 file changed

+45
-1
lines changed

1 file changed

+45
-1
lines changed

test/common/README.md

+45-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This directory contains modules used to test the Node.js implementation.
77
* [Benchmark module](#benchmark-module)
88
* [Common module API](#common-module-api)
99
* [Countdown module](#countdown-module)
10+
* [DNS module](#dns-module)
1011
* [Fixtures module](#fixtures-module)
1112
* [WPT module](#wpt-module)
1213

@@ -404,11 +405,54 @@ Creates a new `Countdown` instance.
404405

405406
Decrements the `Countdown` counter.
406407

407-
### Coutndown.prototype.remaining
408+
### Countdown.prototype.remaining
408409

409410
Specifies the remaining number of times `Countdown.prototype.dec()` must be
410411
called before the callback is invoked.
411412

413+
## DNS Module
414+
415+
The `DNS` module provides a naïve DNS parser/serializer.
416+
417+
### readDomainFromPacket(buffer, offset)
418+
419+
* `buffer` [&lt;Buffer>]
420+
* `offset` [&lt;Number>]
421+
* return [&lt;Object>]
422+
423+
Reads the domain string from a packet and returns an object containing the
424+
number of bytes read and the domain.
425+
426+
### parseDNSPacket(buffer)
427+
428+
* `buffer` [&lt;Buffer>]
429+
* return [&lt;Object>]
430+
431+
Parses a DNS packet. Returns an object with the values of the various flags of
432+
the packet depending on the type of packet.
433+
434+
### writeIPv6(ip)
435+
436+
* `ip` [&lt;String>]
437+
* return [&lt;Buffer>]
438+
439+
Reads an IPv6 String and returns a Buffer containing the parts.
440+
441+
### writeDomainName(domain)
442+
443+
* `domain` [&lt;String>]
444+
* return [&lt;Buffer>]
445+
446+
Reads a Domain String and returns a Buffer containing the domain.
447+
448+
### writeDNSPacket(parsed)
449+
450+
* `parsed` [&lt;Object>]
451+
* return [&lt;Buffer>]
452+
453+
Takes in a parsed Object and writes its fields to a DNS packet as a Buffer
454+
object.
455+
412456
## Fixtures Module
413457

414458
The `common/fixtures` module provides convenience methods for working with

0 commit comments

Comments
 (0)