Registry / web-framework / didip-tollbooth

didip-tollbooth

JSON →
library4.0.2+incompatiblegogounverified

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

go get github.com/didip/tollbooth
INSTALL
IMPORT
SIG · DIDIP-TOLLBOOTH
D
didip-tollbooth
web-frameworkgov4.0.2+incompatible
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

Creates a rate limiter that allows 1 request per second and applies it to a handler.

package main import ( "net/http" "github.com/didip/tollbooth" ) 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
gotchaVersion 4.0.2+incompatible uses Go modules incorrectly; the +incompatible suffix indicates it's a major version without a go.mod file or proper module path.
fix
Use v5 or later if available, or pin to v4 with the +incompatible suffix in go.mod.
affects: >=4.0.0 <5.0.0
Upgrade
Version history
4.0.2+incompatiblelatest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

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