mirror of
https://github.com/tiennm99/is-a-good-dev.git
synced 2026-09-10 04:19:49 +00:00
Update checkRecords.js
This commit is contained in:
+10
-2
@@ -2,17 +2,25 @@ const { checkIfValidIP, checkIfValidFQDN, checkInvalidDomain } = require('./uti
|
||||
|
||||
function checkRecords(data) {
|
||||
const recordType = Object.keys(data.target)[0];
|
||||
|
||||
|
||||
// Check if the domain is invalid
|
||||
if (checkInvalidDomain(data.target[recordType].name) === true) return false;
|
||||
|
||||
|
||||
// Check A record
|
||||
if (recordType.toLowerCase() === 'a') {
|
||||
return checkIfValidIP(data.target[recordType].value);
|
||||
}
|
||||
|
||||
// Check CNAME record
|
||||
if (recordType.toLowerCase() === 'cname') {
|
||||
return checkIfValidFQDN(data.target[recordType].value);
|
||||
}
|
||||
|
||||
// Check if record name matches file name
|
||||
if (recordType.toLowerCase() === 'a' || recordType.toLowerCase() === 'cname') {
|
||||
if (data.target[recordType].name != /* Put file name value here */) return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user