Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RateLimiterMiddleware ¶
type RateLimiterMiddleware struct {
// contains filtered or unexported fields
}
RateLimiterMiddleware implements a rate limiting middleware for HTTP requests.
func New ¶
func New(requestsPerSecond float64, burst int) *RateLimiterMiddleware
New creates a new RateLimiterMiddleware instance.
func (*RateLimiterMiddleware) Process ¶
func (m *RateLimiterMiddleware) Process(ctx context.Context, httpClient *http.Client, req *http.Request, next middleware.NextFunc) (*http.Response, error)
Process applies rate limiting before passing the request to the next middleware.
func (*RateLimiterMiddleware) SetLogger ¶
func (m *RateLimiterMiddleware) SetLogger(l logger.Logger)
SetLogger sets the logger for the middleware.
Click to show internal directories.
Click to hide internal directories.