UNPKG

@amuject/dns

Version:
56 lines (55 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; exports.query = query; var _aaaaa = require("./aaaaa.js"); var _others = require("./others.js"); async function query(domain) { let result = { error: undefined, type: 'DNS', domain: domain, records: {} }; var tasks = []; tasks.push((0, _others.soa)(domain)); tasks.push((0, _aaaaa.a)(domain)); tasks.push((0, _aaaaa.aaaa)(domain)); tasks.push((0, _others.cname)(domain)); tasks.push((0, _others.mx)(domain)); tasks.push((0, _others.txt)(domain)); tasks.push((0, _others.srv)(domain)); tasks.push((0, _others.ns)(domain)); tasks.push((0, _others.caa)(domain)); tasks.push((0, _others.ptr)(domain)); tasks.push((0, _others.naptr)(domain)); tasks.push((0, _others.reverse)(domain)); tasks.push((0, _others.lookup)(domain)); const records = await Promise.all(tasks); for (const record of records) { const key = record.type.substring(4).toLowerCase(); delete record.domain; delete record.type; result.records[key] = record; } return result; } query.a = _aaaaa.a; query.aaaa = _aaaaa.aaaa; query.aaaaa = _aaaaa.aaaaa; query.ip = _aaaaa.ip; query.ips = _aaaaa.ips; query.soa = _others.soa; query.cname = _others.cname; query.mx = _others.mx; query.txt = _others.txt; query.srv = _others.srv; query.ns = _others.ns; query.caa = _others.caa; query.ptr = _others.ptr; query.naptr = _others.naptr; query.reverse = _others.reverse; query.lookup = _others.lookup; var _default = exports.default = query;