From 179eee87e1eea92105af80ccc9f465bf06cb1411 Mon Sep 17 00:00:00 2001 From: Anfernee Gui Date: Tue, 22 Aug 2017 10:41:07 -0700 Subject: [PATCH] Simplify util method IsIPV6 --- core/pkg/net/net.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/core/pkg/net/net.go b/core/pkg/net/net.go index cc4891aa5..d18ca49e8 100644 --- a/core/pkg/net/net.go +++ b/core/pkg/net/net.go @@ -16,15 +16,9 @@ limitations under the License. package net -import ( - _net "net" - "strings" -) +import _net "net" // IsIPV6 checks if the input contains a valid IPV6 address func IsIPV6(ip _net.IP) bool { - if dp := strings.Index(ip.String(), ":"); dp != -1 { - return true - } - return false + return ip.To4() == nil }