ratelimiter

package
Version: v0.0.0-...-ec7f410 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package http decorates an http.Handler and prevents too many requests being made

Index

Constants

View Source
const StatusTooManyRequests = 429

Variables

This section is empty.

Functions

This section is empty.

Types

type RateLimitedHandler

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

func Decorate

func Decorate(delegate http.Handler, rateLimiter RateLimiter) RateLimitedHandler

func (RateLimitedHandler) ServeHTTP

func (lh RateLimitedHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type RateLimiter

type RateLimiter func(*http.Request) (ok bool, retryAfter time.Duration)

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL