package utils import ( "net" ) //Status are saved at database as numbers const ( Online = iota Associating Offline ) // Get interfaces MACs, and the first interface MAC is gonna be used as mqtt clientId func GetMacAddr() ([]string, error) { ifas, err := net.Interfaces() if err != nil { return nil, err } var as []string for _, ifa := range ifas { a := ifa.HardwareAddr.String() if a != "" { as = append(as, a) } } return as, nil }