handlers

package
v1.0.8-mainnet Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: MIT Imports: 12 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")
)
View Source
const (
	VipSubPropTierKey = "tier"
)

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 GetVipStatusByBillingStatus

func GetVipStatusByBillingStatus(bs *web3pay.BillingStatus) (*acl.VipStatus, bool)

func GetVipStatusBySubscriptionStatus

func GetVipStatusBySubscriptionStatus(vss *web3pay.VipSubscriptionStatus) (*acl.VipStatus, bool)

func GetVipTierBySubscription

func GetVipTierBySubscription(vi *types.VipInfo) (acl.VipTier, bool)

func RateLimitAllow

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

func RealIP

func RealIP(next http.Handler) http.Handler

func VipStatusFromContext

func VipStatusFromContext(ctx context.Context) (*acl.VipStatus, bool)

VipStatusFromContext returns VIP status from context

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