Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dchest/throttled-webrate

Another RateLimit for throttled
https://github.com/dchest/throttled-webrate

Last synced: about 1 month ago
JSON representation

Another RateLimit for throttled

Awesome Lists containing this project

README

        

webrate
-------

Package webrate contains a modified RateLimit function for
http://github.com/PuerkitoBio/throttled, which rate limits only specified
HTTP methods and doesn't add headers to response.

EXAMPLE

import (
"net/http"

"github.com/PuerkitoBio/throttled"
"github.com/PuerkitoBio/throttled/store"
"github.com/dchest/throttled-webrate"
)

func main() {

// ...

th := webrate.RateLimit(
throttled.PerMin(30),
[]string{"POST"},
webrate.VaryByPathAndIP("X-Real-IP"),
store.NewMemStore(1000))

http.Handle("/login", th.Throttle(loginHandler))

// ...
}