fix: print ipv6 address with brackets

Massimo Melina committed Jan 24, 2022 at 23:32 UTC 4378e2bccf426510bd3f7c2b0e0a8c2e4740c20b
1 file changed +4 -1
src/listen.ts
+4 -1
@@ -80,7 +80,10 @@ function startServer(srv: http.Server, port: number, secure:string='') {
80 for (const net of nets) {
81 if (net.internal) continue
82 const appendPort = port === (secure ? 443 : 80) ? '' : ':' + port
83 - console.log('-', proto + '://' + net.address + appendPort)
83 + let { address } = net
84 + if (address.includes(':'))
85 + address = '['+address+']'
86 + console.log('-', proto + '://' + address + appendPort)
87 }
88 }
89