mirror of
https://github.com/status-im/go-waku.git
synced 2025-01-13 07:14:10 +00:00
1bffa35dfa
Fixes #560
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, ":")
|
|
}
|