function isInternalIP(ip) {
  // To my knowledge, there aren't any reserved, non-loopback and non-routable
  // IPv6 addresses
  if (net.isIPv6(ip)) {
    return false;
  }

  const exploded = ip.split(".").map((s) => Number.parseInt(s));

  // 127.x.x: loopback addresses are already flagged as "internal" by
  // os.networkInterfaces.
  return (
    exploded[0] === 127 ||
    // 169.254.x.x addresses are APIPA addresses: temporary and non-routable.
    // We need to remove them from the accepted list of IP addresses
    // (this is a "just in case" scenario: APIPA addresses are obsolete and
    // should not be used anymore, but we never know...)
    (exploded[0] === 169 && exploded[1] === 254)
  );
}
Some IPv4 addresses are reserved for internal uses only, and cannot be
reached from other machines. We need to detect and filter them
@param  {String}  ip
@return {Boolean}