Files
spaceDevices/internal/db/utils.go
2018-08-25 15:18:40 +02:00

15 lines
353 B
Go

package db
import "strconv"
// IsMacLocallyAdministered expects the mac in the format e.g. "20:c9:d0:7a:fa:31"
// https://en.wikipedia.org/wiki/MAC_address
func IsMacLocallyAdministered(mac string) bool {
// 00000010
const mask = 1 << 1
first2chars := mac[:2]
decimal, _ := strconv.ParseInt(first2chars, 16, 8)
return (decimal & mask) == mask
}