mirror of
https://github.com/k8snetworkplumbingwg/whereabouts.git
synced 2025-06-03 06:42:26 +00:00
18 lines
306 B
Go
18 lines
306 B
Go
package types
|
|
|
|
import (
|
|
"fmt"
|
|
"net"
|
|
|
|
netutils "k8s.io/utils/net"
|
|
)
|
|
|
|
func sanitizeIP(address string) (net.IP, error) {
|
|
sanitizedAddress := netutils.ParseIPSloppy(address)
|
|
if sanitizedAddress == nil {
|
|
return nil, fmt.Errorf("%s is not a valid IP address", address)
|
|
}
|
|
|
|
return sanitizedAddress, nil
|
|
}
|