ipify

Get your public IP address

Github星跟踪图

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.

主要指标

概览
名称与所有者sindresorhus/ipify
主编程语言JavaScript
编程语言JavaScript (语言数: 2)
平台
许可证MIT License
所有者活动
创建于2014-08-19 04:27:00
推送于2025-09-15 08:10:09
最后一次提交
发布数13
最新版本名称v7.0.0 (发布于 2025-09-15 08:10:02)
第一版名称v1.0.0 (发布于 2014-08-19 04:30:34)
用户参与
星数284
关注者数7
派生数15
提交数43
已启用问题?
问题数15
打开的问题数0
拉请求数6
打开的拉请求数0
关闭的拉请求数0
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?