feat: add a mx check

This commit is contained in:
Renge 2024-04-17 20:10:46 -04:00
parent b49cfbc816
commit b12296d780

View File

@ -62,6 +62,45 @@ const spf = (req, res) => {
}
}
const a = (req, res) => {
try {
const { domain } = req.query;
console.log(domain)
dns.resolve4(domain, (err, address) => {
if (err) {
console.log(err)
return res.status(400).send("ERROR: No a record found")
}
else {
return res.status(200).send(address)
}
})
}
catch (err) {
console.log(err)
}
}
const mx = (req, res) => {
try {
const { domain } = req.query;
console.log(domain)
dns.resolveMx(domain, (err, address) => {
if (err) {
console.log(err)
return res.status(400).send("ERROR: No mx record found")
}
else {
return res.status(200).send(address)
}
})
}
catch (err) {
console.log(err)
}
}
const parseSPF = (domain, spf, swipl, curr, callback) => {
try {
console.log(domain, spf, curr)
@ -263,6 +302,8 @@ const parseSPF = (domain, spf, swipl, curr, callback) => {
}
app.get('/spf', spf)
app.get('/a', a)
app.get('/mx', mx)
app.listen(PORT, (err) => {
if (err) {