Registry / web-framework / didip-tollbooth-v7

didip-tollbooth-v7

JSON →
library7.0.2gogounverified

Package tollbooth provides rate-limiting logic to HTTP request handler.

go get github.com/didip/tollbooth/v7
INSTALL
IMPORT
SIG · DIDIP-TOLLBOOTH-V7
D
didip-tollbooth-v7
web-frameworkgov7.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

tollbooth
github.com/didip/tollbooth/v7

Create a rate limiter that allows 1 request per second and apply it to a handler.

package main import ( "net/http" "github.com/didip/tollbooth/v7" ) func main() { limiter := tollbooth.NewLimiter(1, nil) http.Handle("/", tollbooth.LimitFuncHandler(limiter, func(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Hello, world!")) })) http.ListenAndServe(":8080", nil) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
7.0.2latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
didip-tollbooth-v7 — go get didip-tollbooth-v7 · libregistry