handlers

package
v0.0.0-...-3b2d471 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxKeyRealIP       = CtxKey("Infura-Real-IP")
	CtxKeyRateRegistry = CtxKey("Infura-Rate-Limit-Registry")
	CtxAccessToken     = CtxKey("Infura-Access-Token")
)

Variables

This section is empty.

Functions

func GetAccessToken

func GetAccessToken(r *http.Request) string

func GetAccessTokenFromContext

func GetAccessTokenFromContext(ctx context.Context) (string, bool)

func GetIPAddress

func GetIPAddress(r *http.Request) string

GetIPAddress returns the remote IP address.

func GetIPAddressFromContext

func GetIPAddressFromContext(ctx context.Context) (string, bool)

func RateLimitAllow

func RateLimitAllow(ctx context.Context, name string, n int) bool

func RealIP

func RealIP(next http.Handler) http.Handler

Types

type CtxKey

type CtxKey string

type Middleware

type Middleware func(next http.Handler) http.Handler

func RateLimit

func RateLimit(registry *rate.Registry) Middleware

Jump to

Keyboard shortcuts

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