kea-manage/lib/validators/macaddr/macaddr.go

11 lines
261 B
Go
Raw Permalink Normal View History

package macaddr
import "regexp"
const rxValidMac = `^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$`
// IsValid returns true if the macaddress appears valid, false otherwise
func IsValid(mac string) bool {
return regexp.MustCompile(rxValidMac).MatchString(mac)
}