|
|
@ -29,7 +29,7 @@ var dnspack = exports.DNS_PACKER = { |
|
|
|
dv.setUint16(10, (packet.additional||[]).length + (packet.payload ? 1 : 0), false); |
|
|
|
|
|
|
|
function lint(r) { |
|
|
|
if (!r.name) { |
|
|
|
if (!r.name && 'string' !== typeof r.name) { |
|
|
|
throw new Error("missing name"); |
|
|
|
} |
|
|
|
|
|
|
@ -70,7 +70,8 @@ var dnspack = exports.DNS_PACKER = { |
|
|
|
labelsMap[total] = { total: total, name: sequence }; |
|
|
|
labelsMap[sequence] = labelsMap[total]; |
|
|
|
} |
|
|
|
sequence.split('.').forEach(function (label) { |
|
|
|
// allow 0-length string for TLD root NS queries
|
|
|
|
(sequence && sequence.split('.') || []).forEach(function (label) { |
|
|
|
dv.setUint8(total, label.length, false); |
|
|
|
total += 1; |
|
|
|
|
|
|
|