Update the readme, since Duration is deprecated (#1015)

* Update the readme, since Duration is deprecated

Chance to Expiration

* Update README.md

* Update README.md
pull/1022/head
João Vitor 2020-11-12 16:30:02 -03:00 committed by GitHub
parent 5b08aa1dea
commit df78ede567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 5 deletions

View File

@ -30,12 +30,13 @@ After you initiate your Fiber app, you can use the following possibilities:
app.Use(limiter.New())
// Or extend your config for customization
app.Use(limiter.New(limiter.Config{
Next: func(c *fiber.Ctx) bool {
return c.IP() == "127.0.0.1"
},
Max: 20,
Duration: 30 * time.Second,
Expiration: 30 * time.Second,
Key: func(c *fiber.Ctx) string {
return c.Get("x-forwarded-for")
},
@ -60,10 +61,10 @@ type Config struct {
// Default: 5
Max int
// Duration is the time on how long to keep records of requests in memory
//
// Expiration is the time on how long to keep records of requests in memory
//
// Default: time.Minute
Duration time.Duration
Expiration time.Duration
// Key allows you to generate custom keys, by default c.IP() is used
//
@ -103,4 +104,4 @@ var ConfigDefault = Config{
return c.SendStatus(fiber.StatusTooManyRequests)
},
}
```
```