11 lines
261 B
Go
11 lines
261 B
Go
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)
|
|
}
|