mirror of
https://github.com/tiennm99/is-a-good-dev.git
synced 2026-10-13 08:15:37 +00:00
Add AAAA record type.
This commit is contained in:
1 parent
a4d747d58d
commit
4dbfb16a66
1 file changed
+10
-2
+10
-2
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user