From ba07dc804c9c182b20075e5ce903570482e36ba0 Mon Sep 17 00:00:00 2001 From: Claire Li Date: Fri, 11 Jul 2014 22:08:53 -0700 Subject: [PATCH] pkg/proxy: use net.SplitHostPort instead of strings.Split --- pkg/proxy/roundrobbin.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/proxy/roundrobbin.go b/pkg/proxy/roundrobbin.go index 9d9f2413540..e1526be1998 100644 --- a/pkg/proxy/roundrobbin.go +++ b/pkg/proxy/roundrobbin.go @@ -23,7 +23,6 @@ import ( "net" "reflect" "strconv" - "strings" "sync" "github.com/GoogleCloudPlatform/kubernetes/pkg/api" @@ -57,11 +56,11 @@ func (impl LoadBalancerRR) LoadBalance(service string, srcAddr net.Addr) (string } func (impl LoadBalancerRR) IsValid(spec string) bool { - index := strings.Index(spec, ":") - if index == -1 { + _, port, err := net.SplitHostPort(spec) + if err != nil { return false } - value, err := strconv.Atoi(spec[index+1:]) + value, err := strconv.Atoi(port) if err != nil { return false }