Skip to content

Commit

Permalink
Added timeZone
Browse files Browse the repository at this point in the history
  • Loading branch information
MikelCalvo committed Jun 11, 2024
1 parent c8ef164 commit f8f84b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { IPDox } from "node-ipdox";
const ipdox = new IPDox({
cacheMaxItems: 5000,
cacheMaxAge: 43200000,
maxRetries: 10,
maxRetries: 10
});

ipdox
Expand Down Expand Up @@ -69,6 +69,7 @@ export interface IPDOXResponse {
isTOR: boolean; // Boolean indicating if the IP address is a TOR node (might be undefined)
isProxy: boolean; // Boolean indicating if the IP address is a proxy (might be undefined)
};
timeZone: string; // Time zone
source: string; // Source API
}
```
Expand Down
4 changes: 4 additions & 0 deletions src/ipdox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class IPDox {
isp: response.data.isp,
proxy: response.data.proxy,
isHosting: response.data.hosting,
timeZone: response.data.timezone,
source: "ip-api.com"
};

Expand Down Expand Up @@ -152,6 +153,7 @@ class IPDox {
isp: response.data.isp,
proxy: response.data.proxy,
isHosting: response.data.hosting,
timeZone: response.data.timeZones[0],
source: "freeipapi.com"
};

Expand Down Expand Up @@ -179,6 +181,7 @@ class IPDox {
isp: response.data.connection.isp,
proxy: false,
isHosting: false,
timeZone: response.data.timezone.id,
source: "ipwho.is"
};

Expand All @@ -204,6 +207,7 @@ class IPDox {
longitude: response.data.longitude,
zip: response.data.postal,
isp: response.data.org,
timeZone: response.data.timezone,
source: "ipapi.co"
};

Expand Down
2 changes: 2 additions & 0 deletions src/types/IPDOXResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* @property {boolean} proxyInfo.isVPN Is the IP address a VPN?
* @property {boolean} proxyInfo.isTOR Is the IP address a TOR node?
* @property {boolean} proxyInfo.isProxy Is the IP address a proxy?
* @property {string} timeZone The time zone
* @property {string} source The source of the data
*/
export interface IPDOXResponse {
Expand All @@ -34,5 +35,6 @@ export interface IPDOXResponse {
isTOR: boolean;
isProxy: boolean;
};
timeZone?: string;
source: string;
}

0 comments on commit f8f84b4

Please sign in to comment.