"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() {
  const ifaces = _os.default.networkInterfaces();

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

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

;