Add AAAA record type.

This commit is contained in:
Tweak authored and GitHub committed 2023-01-20 13:41:20 -07:00
1 parent a4d747d58d
commit 4dbfb16a66
1 file changed
+10 -2
+10 -2
View File
@@ -1,11 +1,19 @@
const { checkIfValidIP, checkIfValidFQDN, checkInvalidDomain, isString } = require('./utils.js');
const { checkIfValidIP, checkIfValidIPv6, checkIfValidFQDN, checkInvalidDomain, isString } = require('./utils.js');
function checkRecords(data) {
const recordType = Object.keys(data.target)[0];
const value = data.target[recordType].value;
// Check if the domain is invalid
if (checkInvalidDomain(data.target[recordType].name) === true) return false;
// Check AAAA record
if (recordType.toLowerCase() === 'aaaa') {
if (!Array.isArray(value)) return false;
for (const record of value) {
if (checkIfValidIPv6(record) == false) return false;
}
return true;
}
// Check A record
if (recordType.toLowerCase() === 'a') {
if (!Array.isArray(value)) return false;