mirror of https://github.com/status-im/go-waku.git
17 lines
257 B
Go
17 lines
257 B
Go
|
package utils
|
||
|
|
||
|
import (
|
||
|
"net"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func IsIPv4(str string) bool {
|
||
|
ip := net.ParseIP(str)
|
||
|
return ip != nil && !strings.Contains(str, ":")
|
||
|
}
|
||
|
|
||
|
func IsIPv6(str string) bool {
|
||
|
ip := net.ParseIP(str)
|
||
|
return ip != nil && strings.Contains(str, ":")
|
||
|
}
|