use ab.slice(start, end) instead of ui8 array for rdata

Bu işleme şunda yer alıyor:
AJ ONeal 2017-01-30 11:28:05 -07:00
ebeveyn 6d5251524b
işleme fa180b0d4b
2 değiştirilmiş dosya ile 4 ekleme ve 4 silme

Dosyayı Görüntüle

@ -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];

Dosyayı Görüntüle

@ -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;