25
: { local: [], network: [url] };
26
}
28
>
const network = new Set<string>();
29
>
for (const netInterface of Object.values(networkInterfaces)) {
30
>
for (const detail of netInterface ?? []) {
31
>
if (detail.family !== 'IPv4' || detail.internal) {
32
>
continue;
33
>
}
34
>
35
>
network.add(formatWebSocketUrl(detail.address, port));
36
>
}
37
>
}
38
>
39
>
return {
40
>
local: [formatWebSocketUrl('localhost', port)],
41
>
network: [...network],
42
>
};
43
>
}
44
45
export function formatWebSocketUrl(host: string, port: number): string {