Simplify util method IsIPV6
This commit is contained in:
parent
ed3803cf58
commit
179eee87e1
1 changed files with 2 additions and 8 deletions
|
@ -16,15 +16,9 @@ limitations under the License.
|
||||||
|
|
||||||
package net
|
package net
|
||||||
|
|
||||||
import (
|
import _net "net"
|
||||||
_net "net"
|
|
||||||
"strings"
|
|
||||||
)
|
|
||||||
|
|
||||||
// IsIPV6 checks if the input contains a valid IPV6 address
|
// IsIPV6 checks if the input contains a valid IPV6 address
|
||||||
func IsIPV6(ip _net.IP) bool {
|
func IsIPV6(ip _net.IP) bool {
|
||||||
if dp := strings.Index(ip.String(), ":"); dp != -1 {
|
return ip.To4() == nil
|
||||||
return true
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue