node-modules / address

Get current machine IP and MAC address.
Other
233 stars 32 forks source link

address.ip should not return an alias localhost address #30

Closed jkelleyrtp closed 1 year ago

jkelleyrtp commented 1 year ago

When I create a new localhost alias on macOS, IE 127.0.2.2, address.ip starts to return the wrong address.

This code is the culprit: https://github.com/node-modules/address/blob/master/lib/address.js#L94

This is really easy to simulate via the CLI.

From a fresh environment,

address.ip() ==  "192.168.86.25 "

However, when I bring up an alias

ifconfig lo0 alias 127.0.2.2 up

address.ip starts to return the localhost alias.