()
| 14 | * @returns {Set<string | undefined>} local hosts |
| 15 | */ |
| 16 | const getLocalHosts = () => { |
| 17 | const interfaces = os.networkInterfaces(); |
| 18 | |
| 19 | // Add undefined value for createServer function to use default host, |
| 20 | // and default IPv4 host in case createServer defaults to IPv6. |
| 21 | |
| 22 | const results = new Set([undefined, "0.0.0.0"]); |
| 23 | |
| 24 | for (const _interface of Object.values(interfaces)) { |
| 25 | if (_interface) { |
| 26 | for (const config of _interface) { |
| 27 | results.add(config.address); |
| 28 | } |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | return results; |
| 33 | }; |
| 34 | |
| 35 | /** |
| 36 | * @param {number} basePort base port |
no outgoing calls
no test coverage detected
searching dependent graphs…