* fix: Rate-limit the exportPersonalData endpoint * fix: the RequreSelfUserID validation middleware added
16 lines
245 B
Go
16 lines
245 B
Go
package httprate
|
|
|
|
import (
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/zeebo/xxh3"
|
|
)
|
|
|
|
func LimitCounterKey(key string, window time.Time) uint64 {
|
|
h := xxh3.New()
|
|
h.WriteString(key)
|
|
h.WriteString(strconv.FormatInt(window.Unix(), 10))
|
|
return h.Sum64()
|
|
}
|