New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-cached-dns-resolve

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-cached-dns-resolve - npm Package Compare versions

Comparing version

to
3.1.0

23

axios-cached-dns-resolve.js

@@ -11,2 +11,3 @@ /* eslint-disable no-plusplus */

const dnsResolve = util.promisify(dns.resolve)
const dnsLookup = util.promisify(dns.lookup)

@@ -145,3 +146,3 @@ export const config = {

const ips = await dnsResolve(host)
const ips = await resolve(host)
dnsEntry = {

@@ -176,3 +177,3 @@ host,

const ips = await dnsResolve(value.host)
const ips = await resolve(value.host)
value.ips = ips

@@ -195,2 +196,20 @@ value.updatedTs = Date.now()

/**
*
* @param host
* @returns {*[]}
*/
async function resolve(host) {
let ips
try {
ips = await dnsResolve(host)
} catch (e) {
const lookupResp = await dnsLookup(host)
if (lookupResp.address == null) throw new Error(`fallback to dnsLookup returned no address ${host}`)
// lookup only returns 1 host, resolve returns multiple for round-robin
ips = [lookupResp.address]
}
return ips
}
function recordError(err, errMesg) {

@@ -197,0 +216,0 @@ ++stats.errors

18

package.json
{
"name": "axios-cached-dns-resolve",
"version": "3.0.6",
"version": "3.1.0",
"main": "index",

@@ -35,11 +35,11 @@ "description": "Caches dns resolutions made with async dns.resolve instead of default sync dns.lookup, refreshes in background",

"ava": "^3.15.0",
"axios": "^0.26.1",
"body-parser": "^1.19.2",
"axios": "^0.27.2",
"body-parser": "^1.20.0",
"delay": "^5.0.0",
"eslint": "^8.12.0",
"eslint": "^8.15.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-import": "^2.26.0",
"eslint-watch": "^8.0.0",
"esm": "^3.2.25",
"express": "^4.17.3",
"express": "^4.18.1",
"ignore-styles": "^5.0.1"

@@ -49,6 +49,6 @@ },

"json-stringify-safe": "^5.0.1",
"lru-cache": "^7.7.1",
"pino": "^7.9.2",
"pino-pretty": "^7.6.0"
"lru-cache": "^7.10.0",
"pino": "^7.11.0",
"pino-pretty": "^7.6.1"
}
}