Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

dface

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dface

get ip address by interface

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

npm Build Status

dface

get ip address by interface

for when you want to listen on a particular interface but don't know what the ip address is going to be

eg. when spawning multiple ec2 instances from a pre-configured cloned image

npm install dface


var dface = require('dface');

// so that you can still pass the usual host config through dface
dface(null) == '0.0.0.0';
dface(undefined) == '0.0.0.0';
dface('10.0.0.1') == '10.0.0.1';

// so that you can specify ip by interface/ip-version/alias-seq
dface('eth0') == '10.0.0.1';
dface('eth0/ipv4') == '10.0.0.1';
dface('eth0/ipv6') == '1111:a660:201:e6::4a4:a315';

dface('eth0/ipv4/0') == dface('eth0/ipv4') == dface('eth0'); // default
dface('eth0/ipv4/1') == '55.5.34.99'; // assuming eth0 has a second ip (alias)

dface('eth69/ipv4') THROWS Error('no such interface eth66/ipv4');

in case of confusion, see your interfaces

node -e 'console.log(os.networkInterfaces())'

FAQs

Package last updated on 23 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc