sindresorhus/internal-ip

networkInterfaces key `utun0` is not a ip

noyobo opened this issue · 2 comments

> os.networkInterfaces()
{ lo0:
   [ { address: '::1',
       netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 0,
       internal: true },
     { address: '127.0.0.1',
       netmask: '255.0.0.0',
       family: 'IPv4',
       mac: '00:00:00:00:00:00',
       internal: true },
     { address: 'fe80::1',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '00:00:00:00:00:00',
       scopeid: 1,
       internal: true } ],
  en0:
   [ { address: 'fe80::3e15:c2ff:fedf:58ea',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: '3c:15:c2:df:58:ea',
       scopeid: 4,
       internal: false },
     { address: '192.168.199.134',
       netmask: '255.255.255.0',
       family: 'IPv4',
       mac: '3c:15:c2:df:58:ea',
       internal: false } ],
  awdl0:
   [ { address: 'fe80::b85a:4dff:fe78:452',
       netmask: 'ffff:ffff:ffff:ffff::',
       family: 'IPv6',
       mac: 'ba:5a:4d:78:04:52',
       scopeid: 8,
       internal: false } ],
  utun0:
   [ { address: '30.39.56.182',
       netmask: '255.255.255.255',
       family: 'IPv4',
       mac: '00:00:00:00:00:00',
       internal: false } ] }
internalIp.v4() => 30.39.56.182

This is basically a duplicate of #5. The issue is that this module blindly returns the last non-loopback interface address, which can often be wrong.

The proper solution would be to parse the routing table for the default gatway interface, but right now, the only module that provides this does not work on Windows (https://github.com/indutny/node-netroute).

Finally found This is because I opened the local agent 😂 have to open the agent, the work need.