mirror of https://github.com/gofiber/fiber.git
Update the readme, since Duration is deprecated (#1015)
* Update the readme, since Duration is deprecated Chance to Expiration * Update README.md * Update README.mdpull/1022/head
parent
5b08aa1dea
commit
df78ede567
|
@ -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)
|
||||
},
|
||||
}
|
||||
```
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue