diff options
-rw-r--r-- | gobgp/cmd/common.go | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/gobgp/cmd/common.go b/gobgp/cmd/common.go index fa91e326..51cb414a 100644 --- a/gobgp/cmd/common.go +++ b/gobgp/cmd/common.go @@ -24,6 +24,7 @@ import ( "net" "os" "sort" + "strconv" "time" ) @@ -378,14 +379,7 @@ func (v vrfs) Less(i, j int) bool { func connGrpc() *grpc.ClientConn { timeout := grpc.WithTimeout(time.Second) - - // determine IP address version - host := net.ParseIP(globalOpts.Host) - target := fmt.Sprintf("%s:%d", globalOpts.Host, globalOpts.Port) - if host.To4() == nil { - target = fmt.Sprintf("[%s]:%d", globalOpts.Host, globalOpts.Port) - } - + target := net.JoinHostPort(globalOpts.Host, strconv.Itoa(globalOpts.Port)) conn, err := grpc.Dial(target, timeout, grpc.WithBlock(), grpc.WithInsecure()) if err != nil { fmt.Println(err) |