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.0 to 5.0.1

45

index.d.ts

@@ -1,2 +0,2 @@

import {Resolver, promises as dnsPromises} from 'dns';
import {Resolver, promises as dnsPromises, lookup} from 'dns';
import {Agent} from 'http';

@@ -11,3 +11,3 @@

export interface CacheInstance {
set(hostname: string, entries: EntryObject[], ttl: number): TPromise<void | boolean>;
set(hostname: string, entries: EntryObject[], ttl: number): TPromise<void | boolean | this>;
get(hostname: string): TPromise<EntryObject[] | undefined>;

@@ -35,13 +35,10 @@ delete(hostname: string): TPromise<boolean>;

/**
* The full path to the `hosts` file. Set this to `false` to prevent loading entries from the `hosts` file.
* @default '/etc/hosts'
*/
customHostsPath?: string | false;
/**
* The lifetime of the entries received from the OS (TTL in seconds).
* When the DNS server responds with `ENOTFOUND` or `ENODATA` and the OS reports that the entry is available,
* it will use `dns.lookup(...)` directly for the requested hostnames for the specified amount of time (in seconds).
*
* **Note**: This option is independent, `options.maxTtl` does not affect this.
* @default 1
* If you don't query internal hostnames (such as `localhost`, `database.local` etc.),
* it is strongly recommended to set this value to `0`.
* @default 3600
*/
fallbackTtl?: number;
fallbackDuration?: number;
/**

@@ -54,2 +51,9 @@ * The time how long it needs to remember failed queries (TTL in seconds).

errorTtl?: number;
/**
* The fallback function to use when the DNS server responds with `ENOTFOUND` or `ENODATA`.
*
* **Note**: This has no effect if the `fallbackDuration` option is less than `1`.
* @default dns.lookup
*/
lookup?: typeof lookup;
}

@@ -69,7 +73,7 @@

*/
readonly ttl: number;
readonly ttl?: number;
/**
* The expiration timestamp.
*/
readonly expires: number;
readonly expires?: number;
}

@@ -96,3 +100,3 @@

/**
* DNS servers used to make the query. Can be overridden - then the new servers will be used.
* The DNS servers used to make queries. Can be overridden - doing so will clear the cache.
*/

@@ -123,11 +127,2 @@ servers: string[];

/**
* Returns an entry from the array for the given hostname.
* Useful to implement a round-robin algorithm.
*/
_getEntry(entries: ReadonlyArray<EntryObject>, hostname: string): EntryObject;
/**
* Removes outdated entries.
*/
tick(): void;
/**
* Attaches itself to an Agent instance.

@@ -142,8 +137,10 @@ */

* Updates interface info. For example, you need to run this when you plug or unplug your WiFi driver.
*
* **Note:** Running `updateInterfaceInfo()` will trigger `clear()` only on network interface removal.
*/
updateInterfaceInfo(): void;
/**
* Clears the cache for the given hostname. If the hostname argument is not present, the entire cache will be cleared.
* Clears the cache for the given hostname. If the hostname argument is not present, the entire cache will be emptied.
*/
clear(hostname?: string): void;
}
{
"name": "cacheable-lookup",
"version": "5.0.0",
"version": "5.0.1",
"description": "A cacheable dns.lookup(…) that respects the TTL",

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

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