Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate Limiting for Echo using golang.org/x/time/rate #1721

Closed
3 tasks done
iambenkay opened this issue Dec 16, 2020 · 2 comments · Fixed by #1724
Closed
3 tasks done

Rate Limiting for Echo using golang.org/x/time/rate #1721

iambenkay opened this issue Dec 16, 2020 · 2 comments · Fixed by #1724

Comments

@iambenkay
Copy link
Contributor

iambenkay commented Dec 16, 2020

Feature Request

Checklist

  • Dependencies installed
  • No typos
  • Searched existing issues and docs

I am currently implementing rate limiting in my echo service and I thought it might be a good addition to the echo package considering that Rate Limiting is a popular use case in modern web applications. I don't know if this feature should be a candidate for echo-contrib or the actual echo package.
What I have in mind is token/IP based limiting so that limiting can be tracked per visitor.

@lammel
Copy link
Contributor

lammel commented Dec 16, 2020

There is PR in labstack/echox#142 open with a redis based limiter.
A simple configurale rate limiter middleware without external dependencies would be a great addition for the echo package itself I guess.

@iambenkay
Copy link
Contributor Author

iambenkay commented Dec 16, 2020

That looks good. Basically my idea involves working with in memory token storage by default but creating an interface so any kind of storage can be plugged into it effortlessly.

the only external dependency would be the x/time/rate package which will be used for the default InMemory Limiter.

sync.Mutex will be used to tackle race conditions.

I'll make a PR of what I have later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants