handlers

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

handlers

-- import "github.com/Clever/sphinx/handlers"

Usage

const (
	// StatusTooManyRequests represents HTTP 429, missing from new/http
	StatusTooManyRequests = 429 // not in net/http package
)
func NewHTTPLimiter
func NewHTTPLimiter(rateLimiter ratelimiter.RateLimiter, proxy http.Handler, allowOnError bool) http.Handler

NewHTTPLimiter returns an http.Handler that rate limits and proxies requests.

func NewHTTPLogger
func NewHTTPLogger(rateLimiter ratelimiter.RateLimiter, proxy http.Handler) http.Handler

NewHTTPLogger returns an http.Handler that logs the results of rate limiting requests, but actually proxies everything.

Documentation

Index

Constants

View Source
const (
	// StatusTooManyRequests represents HTTP 429, missing from net/http
	StatusTooManyRequests = 429 // not in net/http package
)

Variables

This section is empty.

Functions

func NewHTTPLimiter

func NewHTTPLimiter(rateLimiter ratelimiter.RateLimiter, proxy http.Handler, allowOnError bool) http.Handler

NewHTTPLimiter returns an http.Handler that rate limits and proxies requests.

func NewHTTPLogger

func NewHTTPLogger(rateLimiter ratelimiter.RateLimiter, proxy http.Handler) http.Handler

NewHTTPLogger returns an http.Handler that logs the results of rate limiting requests, but actually proxies everything.

Types

This section is empty.

Jump to

Keyboard shortcuts

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