almost
This commit is contained in:
parent
faddeb3b88
commit
3600809080
|
@ -20,8 +20,8 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
|||
var data = '';
|
||||
|
||||
var s = {
|
||||
priority: ''
|
||||
, exchange: ''
|
||||
priority: '' // also known as preference
|
||||
, exchange: '' //
|
||||
|
||||
};
|
||||
var temp = ''
|
||||
|
@ -48,13 +48,22 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
|||
data = dv.getUint8(i, false);
|
||||
temp = String.fromCharCode(data);
|
||||
console.log("data at index " + i + ":" + temp);
|
||||
|
||||
if ((temp.trim() === '' && i > 2) || (!temp.match(/^[a-zA-Z0-9._-]+$/) && i > 2)) {
|
||||
s.exchange += ".";
|
||||
}
|
||||
|
||||
temp = temp.match(/^[a-zA-Z0-9._-]+$/);
|
||||
|
||||
// if temp is null, do nothing
|
||||
if (temp === null){
|
||||
|
||||
|
||||
// otherwise, append to s.exchange
|
||||
}else{
|
||||
|
||||
s.exchange += temp;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,7 +75,7 @@ exports.DNS_TYPE_MX = function (ab, packet, record) {
|
|||
|
||||
}
|
||||
|
||||
// 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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue