项目作者: pbnj

项目描述 :
A flexible way to look up IP addresses for host names & URLs
高级语言: JavaScript
项目地址: git://github.com/pbnj/host-to-ip.git
创建时间: 2017-02-10T07:19:14Z
项目社区:https://github.com/pbnj/host-to-ip

开源协议:MIT License

下载


host-to-ip

A flexible way to look up IP addresses for host names (e.g. github.com) and URLs (e.g. https://api.github.com).

Install

npm install --save host-to-ip

Usage

  1. const hostToIp = require('host-to-ip');
  2. const hostname = 'github.com'
  3. const fqdn = 'https://api.github.com'
  4. hostToIp(hostname).then(ip => console.log(ip)).catch(err => console.error(err))
  5. //=> '192.30.253.112'
  6. hostToIp(fqdn, {all: true, family: 4}).then(ip => console.log(ip)).catch(err => console.error(err))
  7. //=> [{"address": "192.30.253.116", "family": 4}, {"address": "192.30.253.117", "family": 4}]

License

MIT © Peter Benjamin