go-chi / httprate

net/http rate limiter middleware
MIT License
270 stars 18 forks source link

Make it possible to dynamically disable the rate limiting #9

Closed ydylla closed 2 years ago

ydylla commented 2 years ago

Hi, this pull request adds the possibility to dynamically disable the rate limiting. For example to allow requests from specific ip ranges without rate limiting them.

It is implemented via a special error httprate.NoRateLimit which custom key functions can return to signal that the rate limit handler should be skipped.

You can find an example in the README.md

I hope you like it 😃

ydylla commented 2 years ago

Hi @pkieltyka, can you please take a look at this? It's only a small change, but I think this would be a useful feature.

ydylla commented 2 years ago

@pkieltyka, how can I move this forward and get it merged?

pkieltyka commented 2 years ago

What about using middleware.Maybe in chi?

ydylla commented 2 years ago

I did not know that exists, now I feel stupid 😅
You are right this would work and is more general. I will close this, thanks.

P.S. Just searched it on https://go-chi.io but it's not listed there, which explains why I missed it.