find-external-interface

1.0.0 • Public • Published

find-external-interface

Build Status Dependency Status Coverage Status

Find the name of a network interface bound to an external (non-localhost) IP address

Usage

This module exports a single function, findExternalInterface.

findExternalInterface

Find the name of a network interface bound to an external (non-localhost) IP address or null if none found. This function returns the name of the first interface which satisfies the criteria.

Parameters

  • options Object? Options
    • options.IPv6 boolean? If true, find IPv6 interface (optional, default false)
    • options.name string? If set, only check interface w/ this name for external address

Examples

const {findExternalInterface} = require('find-external-interface');
const name = findExternalInterface(); // 'eth0'
const info = require('os').networkInterfaces(name); // ip address, etc.

Returns string? Interface name

Installation

$ npm install find-external-interface

Requirements

  • Node.js v4.0.0 or greater

License

© 2017 Christopher Hiller. Licensed MIT.

Dependencies (0)

    Dev Dependencies (19)

    Package Sidebar

    Install

    npm i find-external-interface

    Weekly Downloads

    5

    Version

    1.0.0

    License

    MIT

    Unpacked Size

    5.47 kB

    Total Files

    3

    Last publish

    Collaborators

    • boneskull