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
JavaScript library that can be used in a web browser or Node.js application to gather information for an IP address using https://ipdata.co.
6
6
@@ -10,8 +10,10 @@ JavaScript library that can be used in a web browser or Node.js application to g
10
10
-[Use](#use)
11
11
-[Import Library](#import-library)
12
12
-[Create an Instance](#create-an-instance)
13
+
-[EU Endpoint](#eu-endpoint)
13
14
-[Lookup](#lookup)
14
15
-[Bulk Lookup](#bulk-lookup)
16
+
-[Response Fields](#response-fields)
15
17
16
18
## Install
17
19
@@ -48,20 +50,36 @@ The library will cache 4096 ip addresses responses for 24 hours using a LRU cach
48
50
```js
49
51
constcacheConfig= {
50
52
max:1000, // max size
51
-
maxAge:10*60*1000, //max age in ms (i.e. 10 minutes)
53
+
ttl:10*60*1000, //time-to-live in ms (i.e. 10 minutes)
52
54
};
53
55
constipdata=newIPData('<apiKey>', cacheConfig);
54
56
```
55
57
56
-
**Note:** To disable the cache pass `-1` as the `maxAge`.
58
+
**Note:** To disable the cache pass `1` as the `ttl` (1ms effectively disables caching).
57
59
58
60
```js
59
61
constcacheConfig= {
60
-
maxAge:-1, // disable the cache
62
+
ttl:1, // disable the cache
61
63
};
62
64
constipdata=newIPData('<apiKey>', cacheConfig);
63
65
```
64
66
67
+
### EU Endpoint
68
+
69
+
By default requests are routed to the global endpoint (`https://api.ipdata.co`). To ensure end user data stays in the EU, pass the EU endpoint as the third parameter.
The `company` field returns an object with `name`, `domain`, `network`, and `type` properties.
160
+
161
+
The `carrier` field returns an object with `name`, `mcc`, and `mnc` properties.
162
+
163
+
The `threat` field returns an object with `is_tor`, `is_icloud_relay`, `is_proxy`, `is_datacenter`, `is_anonymous`, `is_known_attacker`, `is_known_abuser`, `is_threat`, `is_bogon`, and `blocklists` properties.
0 commit comments