Browse Source

add brackets to local address string if ipv6

Matthew R. Kasun 2 years ago
parent
commit
f9873020a5
1 changed files with 3 additions and 0 deletions
  1. 3 0
      netclient/functions/common.go

+ 3 - 0
netclient/functions/common.go

@@ -77,6 +77,9 @@ func getPrivateAddr() (string, error) {
 	if local == "" {
 		err = errors.New("could not find local ip")
 	}
+	if net.ParseIP(local).To16() != nil {
+		local = "[" + local + "]"
+	}
 
 	return local, err
 }