You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 619ed8c
Browse filesBrowse the repository at this point in the historyBrowse files
[](https://github.com/ipdata/node/actions/workflows/default.yml)
4
4
5
5
A Node.js library for the [ipdata](https://ipdata.co) API. Look up IP addresses for geolocation, threat intelligence, company data, and more.
6
6
@@ -57,6 +57,8 @@ const ipdata = new IPData('<apiKey>');
57
57
58
58
The library caches up to 4096 responses for 24 hours using an LRU cache by default. You can configure the cache by passing an options object as the second parameter.
59
59
60
+
Entries are keyed by IP address and by what was requested: a lookup restricted with `selectField` or `fields` is cached separately from a full lookup of the same address, so a filtered result is never returned for a full lookup, or the other way round. Only identical selections share an entry (the order of `fields` does not matter). Full lookups are stored under the address itself, so `ipdata.cache.has('1.1.1.1')` tells you whether a complete record is cached.
Use `dispatcher` to send requests through your own [undici dispatcher](https://undici.nodejs.org/#/docs/api/Dispatcher), for example to reach the API through a proxy or to intercept requests in tests. `http2` and `keepAliveTimeout` only apply to the pool the library creates itself.
171
+
Use `dispatcher` to send requests through your own [undici dispatcher](https://undici.nodejs.org/#/docs/api/Dispatcher), for example to reach the API through a proxy or to intercept requests in tests. `http2` and `keepAliveTimeout` only apply to the pool the library creates itself: a dispatcher you inject negotiates HTTP/2 only if it is configured to. For undici's `ProxyAgent` and `EnvHttpProxyAgent` that means `allowH2: true` together with `requestTls: { allowH2: true }`, because the protocols offered on the TLS connection tunnelled through the proxy come from `requestTls`.
A request that fails because the server closed a pooled connection before any response byte arrived (connection reset or closed) is sent once more on a fresh connection; this also covers the `POST` made by `bulkLookup()`. HTTP error statuses are never retried.
193
195
196
+
Every request carries a `User-Agent` header of the form `ipdata-node/<version>`, with the version of the installed package.
197
+
194
198
## Response Fields
195
199
196
200
The following fields are available for use with `selectField` and `fields`:
@@ -207,7 +211,7 @@ The following fields are available for use with `selectField` and `fields`:
207
211
208
212
**`is_anycast`** — `true` when the address is anycast. Also included only when `true`.
Each entry of `threat.blocklists` is `{ name, site, type, first_seen, last_seen, days_seen }`:
213
217
@@ -217,6 +221,14 @@ Each entry of `threat.blocklists` is `{ name, site, type, first_seen, last_seen,
217
221
218
222
Some feeds, for example ipdata's own `vpn` list, do not report these three, so an entry may contain only `name`, `site` and `type`. The dates are passed through as strings.
219
223
224
+
**`threat.scores`** — `{ vpn_score, proxy_score, threat_score, trust_score }`, each a number between 0 and 100.
225
+
226
+
**`region_type`** — the type of administrative region named by `region`; `null` when the location is unknown.
227
+
228
+
**`count`** — the request count for your API key, returned by the API as a string (for example `"0"`).
229
+
230
+
`city`, `region`, `region_code`, `region_type`, `postal` and every value of `time_zone` are `null` when an address has no known location, as is the case for anycast addresses; the TypeScript types declare them as nullable.
231
+
220
232
## TypeScript
221
233
222
234
The library is written in TypeScript and exports the following types:
0 commit comments