"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getIp = getIp;

var _os = _interopRequireDefault(require("os"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function getIp() {
  let ifaces = _os.default.networkInterfaces();

  let ips = [];
  Object.keys(ifaces).forEach(ifname => {
    let a = ifaces[ifname].map(iface => {
      if ('IPv4' !== iface.family || iface.internal !== false) {
        return null;
      }

      return iface.address;
    }).filter(a => a);
    ips = ips.concat(a);
  });
  ips.push('127.0.0.1');
  return ips[0];
}

;