From bcb9adb9666bf9b672cbbeb027242afa81c6abd7 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 13 Jan 2020 14:56:04 +0100 Subject: [PATCH] Updated - catch err for ANY query, readme texts --- README.md | 17 +++++++++++------ index.js | 10 ++++++++-- package-lock.json | 2 +- package.json | 10 +++++----- 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 41aa322..17fa3b5 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # 🌍 DNS Records -**dns-records** is a DNS helper tool for Node.js than can quickly retrieve or discover DNS records for a domain. +**dns-records** is a DNS helper tool for Node.js than can quickly discover and retrieve DNS records for a domain. -Uses `dig` command to make DNS requests, has a built-in list of subdomains to test for and has support for auto-discovering subdomains based on records found. +Uses `dig` command to make DNS requests, has a built-in list of subdomains to test for and has support for auto-discovering more subdomains based on records found. ## Highlights * Retrieves really fast DNS records for a domain @@ -17,6 +17,11 @@ Aiming to have these features: ## Getting Started +#### Requirements + +- `dig` command for DNS lookups +- `time` command to measure response times + #### Installation ```npm i @layered/dns-records``` @@ -117,16 +122,16 @@ Returns a promise which resolves with an `Array` of NS info: soaSerial: '1565080527', IPv4: [ '69.171.239.12' ], IPv6: [ '2a03:2880:fffe:c:face:b00c::35' ], - responseTimev4: '', - responseTimev6: '' + responseTimev4: [ 53 ], + responseTimev6: [ 75 ] }, { ns: 'b.ns.facebook.com.', soaSerial: '1565080527', IPv4: [ '69.171.255.12' ], IPv6: [ '2a03:2880:ffff:c:face:b00c::35' ], - responseTimev4: '', - responseTimev6: '' + responseTimev4: [ 57 ], + responseTimev6: [ 83 ] } ] ``` diff --git a/index.js b/index.js index 7506ea4..95c8aa6 100644 --- a/index.js +++ b/index.js @@ -232,8 +232,14 @@ const getAllRecords = async domain => { // attempt to get ANY DNS records if (!records.length) { - records = await getDnsRecords(domain, 'ANY', nameServers[0].value) - records = records.filter(record => record.type !== 'HINFO') + + try { + records = await getDnsRecords(domain, 'ANY', nameServers[0].value) + records = records.filter(record => record.type !== 'HINFO') + } catch (err) { + // ANY query failed, carry on with other checks + console.warn(err.message) + } // if no ANY records, request basic record types if (!records.length) { diff --git a/package-lock.json b/package-lock.json index 8ccc02a..542b6ab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@layered/dns-records", - "version": "1.3.1", + "version": "1.3.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 09a8bd0..c568557 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@layered/dns-records", - "version": "1.3.1", + "version": "1.3.2", "description": "Discover publicly available DNS Records for a domain", "keywords": [ "dns", @@ -15,15 +15,15 @@ "bugs": { "url": "https://github.com/LayeredStudio/dns-records/issues" }, + "repository": { + "type": "git", + "url": "git+ssh://git@github.com/LayeredStudio/dns-records.git" + }, "homepage": "https://github.com/LayeredStudio/dns-records#readme", "main": "index.js", "scripts": { "test": "mocha -t 25000 -s 5000" }, - "repository": { - "type": "git", - "url": "git+ssh://git@github.com/LayeredStudio/dns-records.git" - }, "dependencies": { "punycode": "^2.1.1" },