From 5e7f754ab3fc8e7defb13517c00661fea3b4527d Mon Sep 17 00:00:00 2001 From: Simon Rogers Date: Sat, 10 Mar 2018 11:31:54 +0100 Subject: [PATCH] Fix TXT record parser, add NSEC --- parser/type.nsec.js | 18 ++++++++++++++++++ parser/type.txt.js | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 parser/type.nsec.js diff --git a/parser/type.nsec.js b/parser/type.nsec.js new file mode 100644 index 0000000..c665a38 --- /dev/null +++ b/parser/type.nsec.js @@ -0,0 +1,18 @@ +(function (exports) { +'use strict'; + +exports.DNS_PARSER_TYPE_NSEC = function (ab, packet, record) { + + var rdataAb = ab.slice(record.rdstart,record.rdstart + record.rdlength) + var dv = new DataView(rdataAb); + + // !!! Not actually implemented !!! + record.priority = 0; + record.weight = 0; + record.port = 0; + record.target = null; + + return record; + +}; +}('undefined' !== typeof window ? window : exports)); diff --git a/parser/type.txt.js b/parser/type.txt.js index 7cb9ea7..fc54686 100644 --- a/parser/type.txt.js +++ b/parser/type.txt.js @@ -10,7 +10,7 @@ var unpackLabels = exports.DNS_UNPACK_LABELS || require('../dns.unpack-labels.js exports.DNS_PARSER_TYPE_TXT = function (ab, packet, record) { var labels = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }); - record.data = [ labels.name ]; + record.data = labels.labels; return record; };