handlers

package
v1.0.1-mainnet Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 6 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

func WhiteListAllow

func WhiteListAllow(ctx context.Context) bool

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