ipbase

0.0.5 • Public • Published

ipbase

NPM version Build Status Coverage Status

IP common function

使用方法

白名单判断

console.log(ipbase.ipInList('127.0.0.1', '127.0.0.1'));
// > true

console.log(ipbase.ipInList('127.0.0.1', ['127.0.0.1', '10.10.110.10']));
// > true

获取客户端地址

var req = {
  headers: {
    'x-real-ip': '198.168.100.54'
  }
}
console.log(ipbase.getClientAddress(req));
// > 198.168.100.54

License

MIT © zswang

Readme

Keywords

Package Sidebar

Install

npm i ipbase

Weekly Downloads

1

Version

0.0.5

License

MIT

Unpacked Size

5.47 kB

Total Files

3

Last publish

Collaborators

  • zswang