0 Star 0 Fork 0

one_love / blog-service

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
limiter.go 451 Bytes
一键复制 编辑 原始数据 按行查看 历史
package limiter
import (
"time"
"github.com/gin-gonic/gin"
"github.com/juju/ratelimit"
)
type LimiterIface interface {
Key(c *gin.Context) string
GetBucket(key string) (*ratelimit.Bucket, bool)
AddBuckets(rules ...LimiterBicketRule) LimiterIface
}
type LimiterBicketRule struct {
Key string
FillInterval time.Duration
Capacity int64
Quantum int64
}
type Limiter struct {
limiterBuckets map[string]*ratelimit.Bucket
}
Go
1
https://gitee.com/one_love/blog-service.git
git@gitee.com:one_love/blog-service.git
one_love
blog-service
blog-service
b40c837dd65d

搜索帮助