()
| 432 | // seem to be true aliases on all systems but ipv4 aliases may or may not be. |
| 433 | private static localHostAliases: string[] = []; |
| 434 | protected static getLocalHostAliases(): string[] { |
| 435 | if (TcpPortScanner.localHostAliases.length === 0) { |
| 436 | // On Unixes, the two are treated like true aliases but on Windows |
| 437 | // you can have distint servers on all of them. So, try everything. |
| 438 | TcpPortScanner.localHostAliases = ['127.0.0.1', '0.0.0.0']; |
| 439 | const ifaces = os.networkInterfaces(); |
| 440 | Object.keys(ifaces).forEach((ifname) => { |
| 441 | (ifaces[ifname] || []).forEach((iface) => { |
| 442 | // Skip external interfaces (VPN tunnels, actual IP, etc). Only want loopbacks |
| 443 | if (iface.internal && ('ipv4' === iface.family.toLowerCase())) { |
| 444 | if (TcpPortScanner.localHostAliases.indexOf(iface.address) === -1) { |
| 445 | TcpPortScanner.localHostAliases.push(iface.address); |
| 446 | } |
| 447 | } |
| 448 | }); |
| 449 | }); |
| 450 | // ConsoleLog(aliases.join(',')); |
| 451 | } |
| 452 | return TcpPortScanner.localHostAliases; |
| 453 | } |
| 454 | |
| 455 | private static badMacs = ['00:00:00:00:00:00', 'ff:ff:ff:ff:ff:ff']; |
| 456 | /** |
no outgoing calls
no test coverage detected