diff --git a/dns.type.a.js b/dns.type.a.js index 0d70dd2..f1dd471 100644 --- a/dns.type.a.js +++ b/dns.type.a.js @@ -4,7 +4,7 @@ // An 'A' record is a 32-bit value representing the IP address exports.DNS_TYPE_A = function (ab, packet, record) { - var ui8 = record.rdata; + var ui8 = new Uint8Array(ab.slice(record.rdstart, record.rdstart + record.rdlength)); // i.e. 127.0.0.1 return ui8[0] + '.' + ui8[1] + '.' + ui8[2] + '.' + ui8[3]; diff --git a/pure-parser.js b/pure-parser.js index 2cdff6a..c798e9e 100644 --- a/pure-parser.js +++ b/pure-parser.js @@ -125,7 +125,7 @@ pdns.unpack = function (ab) { , cpcount: 0 , rdstart: 0 - , rdata: 0 + //, rdata: 0 , rdlength: 0 }); //console.log('unpackAnswer QNAME:'); @@ -157,12 +157,12 @@ pdns.unpack = function (ab) { // TODO actually parse RDATA q.rdstart = total; - q.rdata = new Uint8Array(ab).slice(total, total + q.rdlength); console.log('q.rdata', q.rdata.byteLength, 'bytes:'); - console.log(q.rdata); + console.log(new Uint8Array(ab).slice(total, total + q.rdlength)); //q.rdata = Array.prototype.slice.apply(q.rdata); total += q.rdlength; + //q.rdend = q.rdstart + q.rdlength; q.byteLength = total - ototal; return q;