refactor: abstract ratelimiter package
What does this MR do?
We want to add domain-based ratelimiter. The logic will be identical, but we'll use host instead of IP address.
This MR just removes all the mentions of IP from the rate-limiter package and prepares for the implementation of domain-based rate-limits.
Initial idea was to make ratelimiter
package to take config for both IP and domain rate-limiters and give a single middleware in return.
I think it will be easier to just make it configurable, and return 2 separate middlewares.
TODO
-
I added the Changelog
trailer (e.g.Changelog: feature
) to the commits that need to be included in the changelog -
I added unit tests or they are not required -
I added acceptance tests or they are not required -
I added documentation (or it's not required) -
I followed code review guidelines -
I followed Go Style guidelines
Edited by Vladimir Shushlin