func jwtToken(appid, secret string) (string, error) { token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ "appid": appid, }) // Sign and get the complete encoded token as a string using the secret tokenString, err := token.SignedString(hack.Byte(secret)) if err != nil { return "", err } return tokenString, nil }
// Returns shard under given key. func (m ConcurrentMap) GetShard(key string) *concurrentMapSharded { hasher := fnv.New32() hasher.Write(hack.Byte(key)) return m[uint(hasher.Sum32())%uint(SHARD_COUNT)] }