{"modulePath":"github.com/vcabbage/kit","version":"v0.5.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package ratelimit\n\n## Variables\n\n```go\nvar ErrLimited = errors.New(\"rate limit exceeded\")\n```\nErrLimited is returned in the request path when the rate limiter is triggered and the request is rejected.\n\n## Functions\n\n```go\nfunc NewTokenBucketLimiter(tb *ratelimit.Bucket) endpoint.Middleware\n```\nNewTokenBucketLimiter returns an endpoint.Middleware that acts as a rate limiter based on a token-bucket algorithm. Requests that would exceed the maximum request rate are simply rejected with an error.\n\n```go\nfunc NewTokenBucketThrottler(tb *ratelimit.Bucket, sleep func(time.Duration)) endpoint.Middleware\n```\nNewTokenBucketThrottler returns an endpoint.Middleware that acts as a request throttler based on a token-bucket algorithm. Requests that would exceed the maximum request rate are delayed via the parameterized sleep function. By default you may pass time.Sleep.\n\n","path":"github.com/vcabbage/kit/ratelimit","name":"ratelimit","synopsis":"","isRedistributable":true}
