more dir restructure updates
This commit is contained in:
parent
a26fef5e33
commit
b6f0cff7b8
27
README.md
27
README.md
|
@ -19,7 +19,7 @@ Similar API to `dns.js` and `native-dns-packet`.
|
|||
|
||||
```json
|
||||
{ "header": {
|
||||
"id": 54231
|
||||
"id": 5423
|
||||
, "qr": 0
|
||||
, "opcode": 0
|
||||
, "aa": 0
|
||||
|
@ -133,15 +133,15 @@ How to add a new parser
|
|||
|
||||
Each RR (aka Resource Record or RData) parser is individual. Examples include:
|
||||
|
||||
* A (`dns.type.a.js`)
|
||||
* AAAA (`dns.type.aaaa.js`)
|
||||
* CNAME (`dns.type.cname.js`)
|
||||
* TXT (`dns.type.txt.js`)
|
||||
* SRV (`dns.type.srv.js`)
|
||||
* A (`parser/type.a.js`)
|
||||
* AAAA (`parser/type.aaaa.js`)
|
||||
* CNAME (`parser/type.cname.js`)
|
||||
* TXT (`parser/type.txt.js`)
|
||||
* SRV (`parser/type.srv.js`)
|
||||
|
||||
Let's say that To create a parser for a type which we don't currently support,
|
||||
just add the appropriate information to `dns.types.js` and create a file for
|
||||
the name of the type in the format `dns.type.<typename>.js`.
|
||||
the name of the type in the format `parser/type.<typename>.js`.
|
||||
|
||||
For example, if `CNAME` wasn't already supported and I wanted to add support for
|
||||
it I would follow these steps:
|
||||
|
@ -172,14 +172,14 @@ like and should place that in `test/fixtures/<domain>.<tld>.<type>.json`
|
|||
node bin/capture-query.js --name www.google.com --type CNAME
|
||||
```
|
||||
|
||||
3) Create `dns.type.cname.js`
|
||||
3) Create `parser/type.cname.js`
|
||||
|
||||
Copy `dns.type.TEMPLATE.js` to the type for which you wish to create support
|
||||
(`dns.type.cname.js` in this example) and fill in the blanks.
|
||||
Copy `parser/type.TEMPLATE.js` to the type for which you wish to create support
|
||||
(`parser/type.cname.js` in this example) and fill in the blanks.
|
||||
|
||||
```
|
||||
var unpackLabels = exports.DNS_UNPACK_LABELS || require('./dns.unpack-labels.js').DNS_UNPACK_LABELS;
|
||||
exports.DNS_TYPE_CNAME = function (ab, packet, record) {
|
||||
exports.DNS_PARSER_TYPE_CNAME = function (ab, packet, record) {
|
||||
// record = { rdstart, rdlength, type, class }
|
||||
// example of not parsing and just leaving as binary data
|
||||
record.data = new Uint8Array(ab.slice(record.rdstart, record.rdstart + record.rdlength));
|
||||
|
@ -208,9 +208,12 @@ At the very least someone can follow a few links you followed and your thought p
|
|||
├── doc
|
||||
| └── cname.txt
|
||||
├── dns.classes.js (not necessarily, but potentially)
|
||||
├── dns.type.cname.js
|
||||
├── dns.types.js
|
||||
├── package.json (bump the minor version)
|
||||
├── packer
|
||||
| └── type.cname.js
|
||||
├── parser
|
||||
| └── type.cname.js
|
||||
└── test
|
||||
└── fixtures
|
||||
├── www.google.com.cname.bin
|
||||
|
|
|
@ -38,12 +38,17 @@
|
|||
<!-- I added some of the library files for you -->
|
||||
<script src="./dns.types.js"></script>
|
||||
<script src="./dns.classes.js"></script>
|
||||
<script src="./dns.type.a.js"></script>
|
||||
|
||||
<script src="./parser/type.a.js"></script>
|
||||
<script src="./dns.rdata.parse.js"></script>
|
||||
<script src="./dns.unpack-labels.js"></script>
|
||||
<script src="./dns.parser.js"></script>
|
||||
|
||||
<script src="./packer/type.a.js"></script>
|
||||
<script src="./dns.rdata.pack.js"></script>
|
||||
<script src="./dns.packer.js"></script>
|
||||
<script src="./dns.js"></script>
|
||||
|
||||
<script src="./browser.js"></script>
|
||||
|
||||
<!-- put jquery here -->
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
'use strict';
|
||||
|
||||
// Put some documentation here in these comments.
|
||||
// See examples of documentation in dns.type.a.js
|
||||
// and dns.type.mx.js
|
||||
// See examples of documentation in parser/type.a.js
|
||||
// and parser/type.mx.js
|
||||
|
||||
// If the data type you're wanting to unpack contains labels
|
||||
// (meaning text that will be represented as a period-separated
|
||||
|
|
Loading…
Reference in New Issue