ipify

Get your public IP address

  • 所有者: sindresorhus/ipify
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

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-18 20:27:00
推送於2022-01-01 01:27:37
最后一次提交
發布數12
最新版本名稱v6.0.0 (發布於 2022-01-01 02:27:09)
第一版名稱v1.0.0 (發布於 2014-08-18 22:30:34)
用户参与
星數280
關注者數9
派生數14
提交數40
已啟用問題?
問題數15
打開的問題數1
拉請求數6
打開的拉請求數0
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?