Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Middleware ¶
type Middleware struct {
// contains filtered or unexported fields
}
func New ¶
func New(opts Options) *Middleware
func (*Middleware) Middleware ¶ added in v1.0.2
func (m *Middleware) Middleware() func(http.Handler) http.Handler
Middleware implements ports.Middleware via Handler adapter.
type Options ¶
type Options struct {
Capacity float64 // tokens
RefillRate float64 // tokens per second
Key KeyFn // how to key buckets
RetryAfter time.Duration
// SkipEnabled toggles honoring the SkipHeader. Useful for tests/dev.
SkipEnabled bool
// SkipHeader contains the header name that, when present, bypasses limiting.
// When empty, no bypass is applied.
SkipHeader string
}
Click to show internal directories.
Click to hide internal directories.