mirror of
https://github.com/logos-messaging/logos-messaging-go.git
synced 2026-01-03 22:43:09 +00:00
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, ":")
|
|
}
|