Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inDemoInstall

address

Package Overview
Dependencies
0
Maintainers
1
Versions
13
Issues
File Explorer

Advanced tools

address

Get current machine IP, MAC and DNS servers.

    1.2.2latest
    Github

Version published
Maintainers
1
Weekly downloads
10,336,838
increased by8.18%

Weekly downloads

Changelog

Source

1.2.2 (2022-12-17)

Bug Fixes

  • Auto release on action (#33) (36b30d3)

Readme

Source

address

NPM version Node.js CI Test coverage npm download

Get current machine IP, MAC and DNS servers.

DNS servers receive from /etc/resolv.conf.

Install

$ npm install address

Usage

Get IP is sync and get MAC is async for now.

const address = require('address'); // default interface 'eth' on linux, 'en' on osx. address.ip(); // '192.168.0.2' address.ipv6(); // 'fe80::7aca:39ff:feb0:e67d' address.mac(function (err, addr) { console.log(addr); // '78:ca:39:b0:e6:7d' }); // local loopback address.ip('lo'); // '127.0.0.1' // vboxnet MAC address.mac('vboxnet', function (err, addr) { console.log(addr); // '0a:00:27:00:00:00' });

Get all addresses: IPv4, IPv6 and MAC

address((err, addrs) => { console.log(addrs.ip, addrs.ipv6, addrs.mac); // '192.168.0.2', 'fe80::7aca:39ff:feb0:e67d', '78:ca:39:b0:e6:7d' }); address('vboxnet', (err, addrs) => { console.log(addrs.ip, addrs.ipv6, addrs.mac); // '192.168.56.1', null, '0a:00:27:00:00:00' });

Get an interface info with family

address.interface('IPv4', 'eth1'); // { address: '192.168.1.1', family: 'IPv4', mac: '78:ca:39:b0:e6:7d' }

Get DNS servers

address.dns((err, addrs) => { console.log(addrs); // ['10.13.2.1', '10.13.2.6'] });

License

MIT

Contributors


fengmk2


alsotang


jkelleyrtp


mariodu


mathieutu


zhangyuheng


coolme200


whxaxes

This project follows the git-contributor spec, auto updated at Tue Sep 13 2022 09:09:11 GMT+0800.

Keywords

FAQs

What is address?

Get current machine IP, MAC and DNS servers.

Is address popular?

The npm package address receives a total of 9,903,924 weekly downloads. As such, address popularity was classified as popular.

Is address well maintained?

We found that address demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 17 Dec 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket[email protected]

Product

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc