add request rate limiter

This commit is contained in:
ginuerzh
2022-09-14 19:53:21 +08:00
parent 45b7ac2021
commit 50d443049f
3 changed files with 26 additions and 6 deletions

10
limiter/rate/limiter.go Normal file
View File

@ -0,0 +1,10 @@
package rate
type Limiter interface {
Allow(n int) bool
Limit() float64
}
type RateLimiter interface {
Limiter(key string) Limiter
}