limits

package
v0.0.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter struct {
	// contains filtered or unexported fields
}

Limiter adds request timeouts to HTTP handlers.

func New

func New(maxRequestDuration string) (*Limiter, error)

New creates a new Limiter, which adds the given request timeout to HTTP handlers. The string maxRequestDuration must be parseable as a positive time.Duration; e.g., "5m", "30s".

func (*Limiter) AddRequestTimeout

func (l *Limiter) AddRequestTimeout(next http.Handler) http.Handler

AddRequestTimeout wraps the given handler in a new one that cancels the request context after the duration specified in the limiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL