Socket
Socket
Sign inDemoInstall

cacheable-lookup

Package Overview
Dependencies
0
Maintainers
2
Versions
34
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.0.4 to 6.0.0

2

index.d.ts

@@ -55,3 +55,3 @@ import {Resolver, promises as dnsPromises, lookup} from 'dns';

*/
lookup?: typeof lookup;
lookup?: typeof lookup | false;
}

@@ -58,0 +58,0 @@

{
"name": "cacheable-lookup",
"version": "5.0.4",
"version": "6.0.0",
"description": "A cacheable dns.lookup(…) that respects the TTL",

@@ -5,0 +5,0 @@ "engines": {

@@ -97,3 +97,3 @@ # cacheable-lookup

If you don't query internal hostnames (such as `localhost`, `database.local` etc.), it is strongly recommended to set this value to `0`.
**Note**: You should avoid setting this to `0` unless the provided DNS servers' database is limited to few domains.

@@ -125,3 +125,3 @@ ##### options.errorTtl

**Note**: This has no effect if the `fallbackDuration` option is less than `1`.
If you don't query internal hostnames (such as `localhost`, `database.local` etc.), it is strongly recommended to set this to `false`.

@@ -128,0 +128,0 @@ ### Entry object

@@ -83,3 +83,3 @@ 'use strict';

this._resolver = resolver;
this._dnsLookup = promisify(lookup);
this._dnsLookup = lookup && promisify(lookup);

@@ -100,7 +100,5 @@ if (this._resolver instanceof AsyncResolver) {

if (fallbackDuration < 1) {
this._fallback = false;
} else {
this._fallback = true;
this.fallbackDuration = fallbackDuration;
if (fallbackDuration > 0) {
const interval = setInterval(() => {

@@ -114,2 +112,4 @@ this._hostnamesToFallback.clear();

}
this._fallbackInterval = interval;
}

@@ -332,6 +332,6 @@

if (query.entries.length === 0 && this._fallback) {
if (query.entries.length === 0 && this._dnsLookup) {
query = await this._lookup(hostname);
if (query.entries.length !== 0) {
if (query.entries.length !== 0 && this.fallbackDuration > 0) {
// Use `dns.lookup(...)` for that particular hostname

@@ -338,0 +338,0 @@ this._hostnamesToFallback.add(hostname);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc