handlers

package
v1.1.3-mainnet Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxKeyRateRegistry = CtxKey("Infura-Rate-Limit-Registry")
	CtxKeyAuthId       = CtxKey("Infura-Auth-ID")

	CtxKeyRealIP      = CtxKey("Infura-Real-IP")
	CtxKeyAccessToken = CtxKey("Infura-Access-Token")
	CtxKeyReqOrigin   = CtxKey("Infura-Req-Origin")
	CtxKeyUserAgent   = CtxKey("Infura-User-Agent")
)
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 GetAuthIdFromContext

func GetAuthIdFromContext(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 GetRequestOriginFromContext

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

func GetUserAgentFromContext

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

Types

type CtxKey

type CtxKey string

type Middleware

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

type VipStatus

type VipStatus struct {
	ID   string  // VIP ID
	Tier VipTier // VIP tier
}

func GetVipStatusByBillingStatus

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

func GetVipStatusBySubscriptionStatus

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

func VipStatusFromContext

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

VipStatusFromContext returns VIP status from context

type VipTier

type VipTier uint
const (
	// none VIP tier
	VipTierNone VipTier = iota
	// VIP subscription tier
	VipTierSubscription1
	VipTierSubscription2
	VipTierSubscription3
	VipTierSubscriptionEnd

	// VIP Billing tier
	VipTierBilling = 100
)

func GetVipTierBySubscription

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

Jump to

Keyboard shortcuts

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