MCPcopy Index your code
hub / github.com/webpack/webpack-dev-server / getLocalHosts

Function getLocalHosts

lib/getPort.js:16–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14 * @returns {Set<string | undefined>} local hosts
15 */
16const 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

Callers 1

getPortsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…