ipify

Get your public IP address

  • Owner: sindresorhus/ipify
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

ipify Build Status

Get your public IP address

Using the Ipify API or a custom Ipify instance.

Install

$ npm install ipify

Usage

const ipify = require('ipify');

(async () => {
	console.log(await ipify());
	//=> '2001:0db8:85a3:0000:0000:8a2e:0370:7334'

	console.log(await ipify({useIPv6: false});
	//=> '82.142.31.236'
})();

API

ipify(options?)

Returns a Promise<string> with an IP address.

options

Type: object

useIPv6

Type: boolean
Default: true

Use the IPv6 API endpoint. The IPv6 endpoint will return an IPv6 address if available, IPv4 address otherwise.

Setting the endpoint option will override this.

endpoint

Type: string
Default: 'https://api6.ipify.org'

Custom API endpoint.

FAQ

How is this different from public-ip?

This package only targets the Ipify service, while public-ip targets multiple services, is faster, and more ressilient. Unless you run your own Ipify instance, you probably want public-ip instead.

Main metrics

Overview
Name With Ownersindresorhus/ipify
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2014-08-18 20:27:00
Pushed At2022-01-01 01:27:37
Last Commit At
Release Count12
Last Release Namev6.0.0 (Posted on 2022-01-01 02:27:09)
First Release Namev1.0.0 (Posted on 2014-08-18 22:30:34)
用户参与
Stargazers Count280
Watchers Count9
Fork Count14
Commits Count40
Has Issues Enabled
Issues Count15
Issue Open Count1
Pull Requests Count6
Pull Requests Open Count0
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private