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
|
```json
|
||||||
{ "header": {
|
{ "header": {
|
||||||
"id": 54231
|
"id": 5423
|
||||||
, "qr": 0
|
, "qr": 0
|
||||||
, "opcode": 0
|
, "opcode": 0
|
||||||
, "aa": 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:
|
Each RR (aka Resource Record or RData) parser is individual. Examples include:
|
||||||
|
|
||||||
* A (`dns.type.a.js`)
|
* A (`parser/type.a.js`)
|
||||||
* AAAA (`dns.type.aaaa.js`)
|
* AAAA (`parser/type.aaaa.js`)
|
||||||
* CNAME (`dns.type.cname.js`)
|
* CNAME (`parser/type.cname.js`)
|
||||||
* TXT (`dns.type.txt.js`)
|
* TXT (`parser/type.txt.js`)
|
||||||
* SRV (`dns.type.srv.js`)
|
* SRV (`parser/type.srv.js`)
|
||||||
|
|
||||||
Let's say that To create a parser for a type which we don't currently support,
|
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
|
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
|
For example, if `CNAME` wasn't already supported and I wanted to add support for
|
||||||
it I would follow these steps:
|
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
|
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
|
Copy `parser/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.
|
(`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;
|
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 }
|
// record = { rdstart, rdlength, type, class }
|
||||||
// example of not parsing and just leaving as binary data
|
// example of not parsing and just leaving as binary data
|
||||||
record.data = new Uint8Array(ab.slice(record.rdstart, record.rdstart + record.rdlength));
|
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
|
├── doc
|
||||||
| └── cname.txt
|
| └── cname.txt
|
||||||
├── dns.classes.js (not necessarily, but potentially)
|
├── dns.classes.js (not necessarily, but potentially)
|
||||||
├── dns.type.cname.js
|
|
||||||
├── dns.types.js
|
├── dns.types.js
|
||||||
├── package.json (bump the minor version)
|
├── package.json (bump the minor version)
|
||||||
|
├── packer
|
||||||
|
| └── type.cname.js
|
||||||
|
├── parser
|
||||||
|
| └── type.cname.js
|
||||||
└── test
|
└── test
|
||||||
└── fixtures
|
└── fixtures
|
||||||
├── www.google.com.cname.bin
|
├── www.google.com.cname.bin
|
||||||
|
|
11
demo.html
11
demo.html
|
@ -32,18 +32,23 @@
|
||||||
JSON (Uint8Array):<br>
|
JSON (Uint8Array):<br>
|
||||||
<output type="text" name="hex" value="">
|
<output type="text" name="hex" value="">
|
||||||
<br>-->
|
<br>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- I added some of the library files for you -->
|
<!-- I added some of the library files for you -->
|
||||||
<script src="./dns.types.js"></script>
|
<script src="./dns.types.js"></script>
|
||||||
<script src="./dns.classes.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.rdata.parse.js"></script>
|
||||||
<script src="./dns.unpack-labels.js"></script>
|
<script src="./dns.unpack-labels.js"></script>
|
||||||
<script src="./dns.parser.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.packer.js"></script>
|
||||||
<script src="./dns.js"></script>
|
<script src="./dns.js"></script>
|
||||||
|
|
||||||
<script src="./browser.js"></script>
|
<script src="./browser.js"></script>
|
||||||
|
|
||||||
<!-- put jquery here -->
|
<!-- put jquery here -->
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
// Put some documentation here in these comments.
|
// Put some documentation here in these comments.
|
||||||
// See examples of documentation in dns.type.a.js
|
// See examples of documentation in parser/type.a.js
|
||||||
// and dns.type.mx.js
|
// and parser/type.mx.js
|
||||||
|
|
||||||
// If the data type you're wanting to unpack contains labels
|
// If the data type you're wanting to unpack contains labels
|
||||||
// (meaning text that will be represented as a period-separated
|
// (meaning text that will be represented as a period-separated
|
||||||
|
|
Loading…
Reference in New Issue