1.0.9 • Published 12 months ago

geo-ipify v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
12 months ago

Geo Ipify

Easily get your public IP address, network details, and internet service provider info.

See live example usage here

Using the Geo Ipify

This is built on Ipify API, to get user's IP address & you can also get more information from the IP address by passing an APIKEY gotten from get ipify website.

To get IP address with all it's network information, retrieve a free API key from here https://geo.ipify.org/

Install

npm install geo-ipify or yarn add geo-ipify

Usage

Use the getIpAddressOnly() to get only user's IP address. You DO NOT need to add an API key

Use the getIpAddressAndNetworkInfo(apiKey: string, ipAddress?: string) To get more network information from an IP address. You need to add an API key. For this example you can add an optional ipAddress parameter if the IP you want to check is a specific IP address.

Example

import { getIpAddressOnly, getIpAddressAndNetworkInfo } from 'geo-ipify';

// IP address only
const result = await getIpAddressOnly();
// You can explicitly pass in an optional ipAddress parameter as well if you want to.
// getIpAddressOnly('187.201.32.8');

console.log(result.data);
//=> { "ip": "187.201.32.8" }


// IP address with all network information
const result = await getIpAddressAndNetworkInfo('apikey', '8.8.8.8');
// The IP address parameter is optional
// getIpAddressAndNetworkInfo('apikey');

console.log(result.data);
//=> {
//     "ip": "8.8.8.8",
//     "location": {
//         "country": "US",
//         "region": "California",
//         "timezone": "-07:00",
//     },
//     "domains": [
//         "0d2.net",
//         "003725.com",
//         "0f6.b0094c.cn",
//         "007515.com",
//         "0guhi.jocose.cn"
//     ],
//     "as": {
//         "asn": 15169,
//         "name": "Google LLC",
//         "route": "8.8.8.0/24",
//         "domain": "https://about.google/intl/en/",
//         "type": "Content"
//     },
//     "isp": "Google LLC"
// }

See live example usage here

API

getIpAddressOnly()

Returns a Promise<object> with an object containing your ip address only. You can explicitly pass in an optional ipAddress parameter as well if you want to.

getIpAddressAndNetworkInfo(apiKey)

Returns a Promise<object> with an object containing your ip address and other network and device information, for this you need to add an API key. You can add an optional ipAddress parameter if the IP you want to check is a specific IP address.

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

1 year ago

0.3.9

1 year ago

1.0.9

12 months ago

1.0.8

12 months ago

1.0.7

12 months ago

1.0.6

12 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.9

2 years ago

0.2.8

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago