fix: too many networks printed on mac
Massimo Melina committed
Aug 18, 2022 at 23:33 UTC
9eb211bf76111b3c83c917fe8eadf08582310457
1 file changed
+4
-2
server/src/listen.ts
+4
-2
@@ -171,7 +171,7 @@ export function getStatus() {
171
}
172
}
173
174
-const ignore = /^(lo|.*loopback.*|virtualbox.*|.*\(wsl\).*)$/i // avoid giving too much information
174
+const ignore = /^(lo|.*loopback.*|virtualbox.*|.*\(wsl\).*|llw\d|awdl\d|utun\d|anpi\d)$/i // avoid giving too much information
175
176
export function getUrls() {
177
return Object.fromEntries(onlyTruthy([httpSrv, httpsSrv].map(srv => {
@@ -195,7 +195,9 @@ export function getUrls() {
195
function printUrls(port: number, proto: string) {
196
if (!port) return
197
for (const [name, nets] of Object.entries(networkInterfaces())) {
198
- if (!nets || ignore.test(name)) continue
198
+ if (!nets) continue
199
+ const filteredNets = nets.filter(n => !n.internal)
200
+ if (!filteredNets.length || ignore.test(name)) continue
201
console.log('network', name)
202
for (const net of nets) {
203
if (net.internal) continue