2024-09-24 22:58:42 +00:00
|
|
|
package macaddr
|
|
|
|
|
|
|
|
import "regexp"
|
|
|
|
|
|
|
|
const rxValidMac = `^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$`
|
|
|
|
|
2024-09-26 19:34:17 +00:00
|
|
|
// IsValid returns true if the macaddress appears valid, false otherwise
|
2024-09-24 22:58:42 +00:00
|
|
|
func IsValid(mac string) bool {
|
|
|
|
return regexp.MustCompile(rxValidMac).MatchString(mac)
|
|
|
|
}
|