package types import "strings" var types = map[string]int{ "macaddr": 0, "hwaddr": 0, "invalid": 255, } func Lookup(rtype string) int { rtype = strings.ToLower(rtype) if t, ok := types[rtype]; ok == true { return t } return types["invalid"] }