diff --git a/dns.parser.js b/dns.parser.js index eb83fcb..5a27dcf 100644 --- a/dns.parser.js +++ b/dns.parser.js @@ -72,14 +72,14 @@ pdns.unpack = function (ab) { function unpackQuestion(ab, dv, ui8, total) { var ototal = total; var q = pdns._unpackLabels(ui8, total, { - name: '' - , type: 0 - , typeName: '' - , class: 0 - , className: '' - , byteLength: 0 - , labels: [] - , cpcount: 0 + name: '' // ex: daplie.com + , type: 0 // ex: 1 + , typeName: '' // ex: A + , class: 0 // ex: 1 + , className: '' // ex: IN + , byteLength: 0 // the total byte length (including pointers, but not their labels) + , labels: [] // an array of the labels individually + , cpcount: 0 // the number of compression pointers traversed }); //console.log('unpackQuestion QNAME:'); //console.log(q); diff --git a/dns.type.mx.js b/dns.type.mx.js index a508b4d..ebb5505 100644 --- a/dns.type.mx.js +++ b/dns.type.mx.js @@ -1,8 +1,6 @@ (function (exports) { 'use strict'; -// TODO. Not yet implemented - // Value: Preference // Meaning/Use: Unsigned 16-bit integer //------------------------------------- @@ -14,20 +12,13 @@ var unpackLabels = exports.DNS_UNPACK_LABELS || require('./dns.unpack-labels.js').DNS_UNPACK_LABELS; exports.DNS_TYPE_MX = function (ab, packet, record) { + var rdataAb = ab.slice(record.rdstart, record.rdstart + record.rdlength); + var dv = new DataView(rdataAb); - var rdataAb = ab.slice(record.rdstart, record.rdstart + record.rdlength) - var dv = new DataView(rdataAb); - - var s = { - priority: dv.getUint16(0, false) - , exchange: unpackLabels(new Uint8Array(ab), record.rdstart+2, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name - - }; - - - - return s; - + return { + priority: dv.getUint16(0, false) + , exchange: unpackLabels(new Uint8Array(ab), record.rdstart+2, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name + }; };