Documentation ¶
Index ¶
- Constants
- func AuthorizeUser(ctx context.Context, walletAddress string, ...) (*pb.AccessTokenPayload, error)
- func CreateLimiterRedisStore(redisConnURL string) (limiter.Store, error)
- func GrpcExtractMetadata(ctx context.Context, req any, _ *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func GrpcLogger(ctx context.Context, req any, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func GrpcRateLimiter(ctx context.Context, req any, info *grpc.UnaryServerInfo, ...) (resp interface{}, err error)
- func HTTPExtractMetadata(handler http.Handler) http.Handler
- func HTTPLogger(handler http.Handler) http.Handler
- func HTTPRateLimiter(handler http.Handler) http.Handler
- func InitializeLimiters(store limiter.Store) error
- type ErrorResponse
- type ReqContextKey
- type ResponseRecorder
Constants ¶
View Source
const ( InternalServerError string = "An unexpected error occurred while processing your request." RateLimitExceededError string = "Slow down! Too many requests. Try again shortly. Thank you!" MissingXForwardedForHeaderError string = "X-Forwarded-For header is required for accurate processing." )
Errors
Variables ¶
This section is empty.
Functions ¶
func AuthorizeUser ¶
func AuthorizeUser(ctx context.Context, walletAddress string, authService services.AuthGrpcService) (*pb.AccessTokenPayload, error)
func CreateLimiterRedisStore ¶
func GrpcExtractMetadata ¶
func GrpcExtractMetadata(ctx context.Context, req any, _ *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
func GrpcLogger ¶
func GrpcLogger(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
func GrpcRateLimiter ¶
func GrpcRateLimiter(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
func InitializeLimiters ¶
func InitializeLimiters(store limiter.Store) error
Types ¶
type ErrorResponse ¶
type ReqContextKey ¶
type ReqContextKey string
const ( ClientIP ReqContextKey = "client_ip" ServiceAuthentication ReqContextKey = "service_authentication" AuthenticatedService ReqContextKey = "authenticated_service" )
type ResponseRecorder ¶
type ResponseRecorder struct { http.ResponseWriter StatusCode int Body []byte }
func (*ResponseRecorder) WriteHeader ¶
func (rec *ResponseRecorder) WriteHeader(statusCode int)
Click to show internal directories.
Click to hide internal directories.