left some comments to explain code and my error. Code is kind of confusing for outside readers, but you can kind of see what I'm trying to do.
This commit is contained in:
parent
3600809080
commit
5f048f3486
|
@ -45,20 +45,24 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
||||||
|
// get data from uint8 array
|
||||||
data = dv.getUint8(i, false);
|
data = dv.getUint8(i, false);
|
||||||
|
// get the string from the data
|
||||||
temp = String.fromCharCode(data);
|
temp = String.fromCharCode(data);
|
||||||
console.log("data at index " + i + ":" + temp);
|
console.log("data at index " + i + ":" + temp);
|
||||||
|
|
||||||
|
// I need to place the '.' in the correct place. This is wrong though.
|
||||||
if ((temp.trim() === '' && i > 2) || (!temp.match(/^[a-zA-Z0-9._-]+$/) && i > 2)) {
|
if ((temp.trim() === '' && i > 2) || (!temp.match(/^[a-zA-Z0-9._-]+$/) && i > 2)) {
|
||||||
s.exchange += ".";
|
s.exchange += ".";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// filter out everything that isn't a valid character
|
||||||
temp = temp.match(/^[a-zA-Z0-9._-]+$/);
|
temp = temp.match(/^[a-zA-Z0-9._-]+$/);
|
||||||
|
|
||||||
// if temp is null, do nothing
|
// if temp is null, do nothing
|
||||||
if (temp === null){
|
if (temp === null){
|
||||||
|
|
||||||
|
|
||||||
// otherwise, append to s.exchange
|
// otherwise, append to s.exchange
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
@ -66,16 +70,12 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the below code returns an empty string.
|
||||||
|
|
||||||
|
// s.exchange = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).labels;
|
||||||
}
|
|
||||||
|
|
||||||
// s.exchange = unpackLabels(new Uint8Array(ab), record.rdstart, { byteLength: 0, cpcount: 0, labels: [], name: '' }).name;
|
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue