/* @flow */

const os = require('os');

const IGNORE_INTERFACES = ['lo0', 'awdl0', 'bridge0'];
const LOCAL_IPS = ['127.0.0.1', '::1'];

export function isOffline(): boolean {
  const interfaces = os.networkInterfaces();

  for (const name in interfaces) {
    if (IGNORE_INTERFACES.indexOf(name) >= 0) {
      continue;
    }

    const addrs = interfaces[name];
    for (const addr of addrs) {
      if (LOCAL_IPS.indexOf(addr.address) < 0) {
        // found a possible local ip
        return false;
      }
    }
  }

  return true;
}

@@ -170,21 +170,44 @@
 ean %7B%0A  
-const
+let interfaces;%0A%0A  try %7B%0A   
  interfa
@@ -235,16 +235,325 @@
 faces();
+%0A  %7D catch (e) %7B%0A    // As of October 2016, Windows Subsystem for Linux (WSL) does not support%0A    // the os.networkInterfaces() call and throws instead. For this platform,%0A    // assume we are online.%0A    if (e.syscall === 'uv_interface_addresses') %7B%0A      return false;%0A    %7D else %7B%0A      throw e;%0A    %7D%0A  %7D
 %0A%0A  for 
@@ -801,13 +801,14 @@
 ble 
-local
+remote
  ip%0A

Support unimplemented call in Windows Subsystem for Linux (#772)