Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zcong1993/gin-ratelimit
ratelimit middleware for gin
https://github.com/zcong1993/gin-ratelimit
Last synced: about 23 hours ago
JSON representation
ratelimit middleware for gin
- Host: GitHub
- URL: https://github.com/zcong1993/gin-ratelimit
- Owner: zcong1993
- License: mit
- Created: 2018-04-22T16:56:46.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-03T09:28:33.000Z (about 4 years ago)
- Last Synced: 2023-07-27T22:49:23.975Z (over 1 year ago)
- Language: Go
- Size: 7.81 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gin-ratelimit [![Go Report Card](https://goreportcard.com/badge/github.com/zcong1993/gin-ratelimit)](https://goreportcard.com/report/github.com/zcong1993/gin-ratelimit) [![CircleCI branch](https://img.shields.io/circleci/project/github/zcong1993/gin-ratelimit/master.svg)](https://circleci.com/gh/zcong1993/gin-ratelimit/tree/master) [![codecov](https://codecov.io/gh/zcong1993/gin-ratelimit/branch/master/graph/badge.svg)](https://codecov.io/gh/zcong1993/gin-ratelimit)
> ratelimit middleware for gin
**IMPORTANT:** DO NOT USE IT IN PRODUCTION!!! USE [https://github.com/ulule/limiter](https://github.com/ulule/limiter)
## Install
```sh
$ go get -v github.com/zcong1993/gin-ratelimit
```## Usage
```go
func main() {
router := gin.New()
router.Use(ratelimit.Default())
router.GET("/", func(c *gin.Context) {
c.String(200, testResp)
})
router.Run(":8080")
}
``````go
func main() {
router := gin.New()
router.Use(ratelimit.New(ratelimit.Config{Duration: 1, RateLimit: 1}))
router.GET("/", func(c *gin.Context) {
c.String(200, testResp)
})
router.Run(":8080")
}
```## License
MIT © zcong1993