From 9baab5712a400a5b4973156137d94a2ebab42b3b Mon Sep 17 00:00:00 2001 From: Reid Burke Date: Wed, 19 Sep 2012 15:20:58 -0700 Subject: [PATCH] Skip Back to My Mac or VPNs for LAN IP. --- lib/cli.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/cli.js b/lib/cli.js index f8faf648..37e7b952 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -279,7 +279,8 @@ var getLocalIP = (function () { var cachedIP; function queryLocalIP() { - var localIP, + var name, + localIP, addresses, interfaces = os.networkInterfaces(), interfaceNames = Object.keys(interfaces); @@ -296,7 +297,14 @@ var getLocalIP = (function () { } do { - interfaces[interfaceNames.pop()] + name = interfaceNames.pop() + + // Skip Back to My Mac or VPNs. + if (name.indexOf("utun") === 0) { + continue; + } + + interfaces[name] .filter(internalOnly) .forEach(tryAddresses); } while (interfaceNames.length && !localIP);