limiter:Go的无效简单速率限制中间件

时间:2021-04-06 07:41:36
【文件属性】:
文件名称:limiter:Go的无效简单速率限制中间件
文件大小:43KB
文件格式:ZIP
更新时间:2021-04-06 07:41:36
Go 限幅器 Go的无效简单速率限制中间件。 简单的API 后端的“存储”方法 Redis支持(但也没有捆绑) 中间件:HTTP, 和 安装 使用 $ go get github.com/ulule/limiter/v3@v3.8.0 用法 五个步骤: 创建一个limiter.Rate实例(每个周期的请求数) 创建一个limiter.Store实例(请参阅或 ) 创建一个limiter.Limiter实例,该实例以store和rate实例为参数 使用您选择的中间件创建中间件实例 将限制器实例提供给中间件初始化程序 例子: // Create a rate with the given limit (number of requests) for the given // period (a time.Duration of your choice). import "github
【文件预览】:
limiter-master
----limiter_test.go(330B)
----.circleci()
--------config.yml(751B)
----options.go(1009B)
----.gitignore(14B)
----README.md(7KB)
----.github()
--------dependabot.yml(162B)
----examples()
--------README.md(638B)
----network.go(2KB)
----LICENSE(1KB)
----.dockerignore(62B)
----drivers()
--------middleware()
--------store()
----go.mod(230B)
----rate.go(1013B)
----limiter.go(1KB)
----.golangci.yml(1KB)
----AUTHORS(135B)
----scripts()
--------test(494B)
--------conf()
--------redis(1KB)
--------go-wrapper(1KB)
--------lint(616B)
----rate_test.go(950B)
----defaults.go(409B)
----internal()
--------bytebuffer()
--------fasttime()
----go.sum(14KB)
----.editorconfig(345B)
----Makefile(66B)
----network_test.go(5KB)
----store.go(1KB)

网友评论