use ab.slice(start, end) instead of ui8 array for rdata
This commit is contained in:
parent
6d5251524b
commit
fa180b0d4b
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue