wrote the code but dns.rdat.pack.js is having trouble finding the packer for some reason.

This commit is contained in:
westley 2017-03-18 11:40:14 -06:00
parent cfae86e5f1
commit 28fbc44824
1 changed files with 23 additions and 26 deletions

View File

@ -4,35 +4,32 @@
// Record type is just any text. // Record type is just any text.
exports.DNS_PACKER_TYPE_TXT = function (ab, dv, total, record) { exports.DNS_PACKER_TYPE_TXT = function (ab, dv, total, record) {
// if (!record.data){ if (!record.data){
// throw new Error("no data for TXT record"); throw new Error("no data for TXT record");
// } }
var txtLen = 0;
var rdLenIndex = total;
total += 2;
// RDATA
record.data.split('.').forEach(funtion(label){
txtLen += 1 + label.length;
dv.setUint8(total, label.length, false);
total += 1;
label.split('').forEach(function (ch) {
dv.setUint8(total, ch.charCodeAt(0), false);
total += 1;
});
});
// console.log("record data is: " + record.data); dv.setUint16(rdLenIndex, record.data.length + 1, flase);s
// var txtLen = 0; return total;
// var rdLenIndex = total;
// total += 2;
// //RDATA
// // a sequence of labels
// record.data.split('.').forEach(function (label) {
// txtLen += 1 + label.length;
// dv.setUint8(total, label.length, false);
// total += 1;
// label.split('').forEach(function (ch) {
// dv.setUint8(total, ch.charCodeAt(0), false);
// total += 1;
// });
// });
// // RDLENGTH
// dv.setUint16(rdLenIndex, record.data.length + 1, false);
// return total;
}; };
}('undefined' !== typeof window ? window : exports)); }('undefined' !== typeof window ? window : exports));