aboutsummaryrefslogtreecommitdiffstats
path: root/plumbing/transport/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'plumbing/transport/common.go')
-rw-r--r--plumbing/transport/common.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/plumbing/transport/common.go b/plumbing/transport/common.go
index 89bd3d5..c6a054a 100644
--- a/plumbing/transport/common.go
+++ b/plumbing/transport/common.go
@@ -227,11 +227,17 @@ func parseURL(endpoint string) (*Endpoint, error) {
pass, _ = u.User.Password()
}
+ host := u.Hostname()
+ if strings.Contains(host, ":") {
+ // IPv6 address
+ host = "[" + host + "]"
+ }
+
return &Endpoint{
Protocol: u.Scheme,
User: user,
Password: pass,
- Host: u.Hostname(),
+ Host: host,
Port: getPort(u),
Path: getPath(u),
}, nil