middleware

package
v0.0.0-...-870ec01 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger() func(c *fiber.Ctx) error

func RateLimitMiddleware

func RateLimitMiddleware(tag string, limit int32, duration time.Duration) func(c *fiber.Ctx) error

func UserAuthMiddleware

func UserAuthMiddleware(required bool) func(c *fiber.Ctx) error

Types

type PayloadJWT

type PayloadJWT struct {
	ID           primitive.ObjectID `json:"id"`          // User App ID
	TWID         string             `json:"twid"`        // Twitch ID
	Permissions  string             `json:"permissions"` // Permission bitmask from user's role
	TokenVersion string             `json:"version"`     // Token version to match against for JWT invalidation
	CreatedAt    time.Time          `json:"created_at"`
}

type RateLimiter

type RateLimiter struct {
	RedisKey string

	Identifier string
	Limit      int32
	Remaining  int32
	Reset      time.Duration
}

Jump to

Keyboard shortcuts

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