middleware

package
v0.0.0-...-aa585a7 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminAuth

func AdminAuth(c *gin.Context)

func CORS

func CORS() gin.HandlerFunc

func Distribute

func Distribute(c *gin.Context)

func ForceRateLimit

func ForceRateLimit(ctx context.Context, key string, maxRequestNum int, duration time.Duration) bool

ignore redis error

func GlobalAPIRateLimit

func GlobalAPIRateLimit(c *gin.Context)

func MemoryRateLimit

func MemoryRateLimit(_ context.Context, key string, maxRequestNum int, duration time.Duration) bool

func RateLimit

func RateLimit(ctx context.Context, key string, maxRequestNum int, duration time.Duration) (bool, error)

func RelayPanicRecover

func RelayPanicRecover(c *gin.Context)

func RequestID

func RequestID(c *gin.Context)

func SetUpLogger

func SetUpLogger(server *gin.Engine)

func SetupContextForSelectedChannel

func SetupContextForSelectedChannel(c *gin.Context, channel *model.Channel, modelName string)

func TokenAuth

func TokenAuth(c *gin.Context)

Types

type ModelRequest

type ModelRequest struct {
	Model string `form:"model" json:"model"`
}

Jump to

Keyboard shortcuts

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