portlist: exclude services bound to IPv6 loopback address

Fixes #1683

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2021-04-12 09:06:57 -07:00
parent 87eb8384f5
commit f325aa7e38
2 changed files with 17 additions and 2 deletions
+4 -1
View File
@@ -42,7 +42,10 @@ func parsePort(s string) int {
}
func isLoopbackAddr(s string) bool {
return strings.HasPrefix(s, "127.0.0.1:") || strings.HasPrefix(s, "127.0.0.1.")
return strings.HasPrefix(s, "127.0.0.1:") ||
strings.HasPrefix(s, "127.0.0.1.") ||
strings.HasPrefix(s, "[::1]:") ||
strings.HasPrefix(s, "::1.")
}
type nothing struct{}