middlewares

package
v4.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2025 License: AGPL-3.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(c *gin.Context)

Auth is a middleware that checks if the user is logged in. if token is empty, set user to guest

func AuthAdmin

func AuthAdmin(c *gin.Context)

func AuthNotGuest

func AuthNotGuest(c *gin.Context)

func Authn

func Authn(c *gin.Context)

func Down

func Down(verifyFunc func(string, string) error) func(c *gin.Context)

func DownloadRateLimiter

func DownloadRateLimiter(limiter stream.Limiter) gin.HandlerFunc

func FilteredLoggerWithConfig added in v4.0.9

func FilteredLoggerWithConfig(config FilteredLoggerConfig) gin.HandlerFunc

FilteredLoggerWithConfig returns a gin.HandlerFunc (middleware) that logs requests but skips logging for specified paths, methods, or path prefixes

func ForceHttps

func ForceHttps(c *gin.Context)

func FsUp

func FsUp(c *gin.Context)

func HTTPFilteredLogger added in v4.0.9

func HTTPFilteredLogger() gin.HandlerFunc

HTTPFilteredLogger returns a filtered logger for the main HTTP server

func MaxAllowed

func MaxAllowed(n int) gin.HandlerFunc

func S3FilteredLogger added in v4.0.9

func S3FilteredLogger() gin.HandlerFunc

S3FilteredLogger returns a filtered logger for the S3 server

func SearchIndex

func SearchIndex(c *gin.Context)

func StoragesLoaded

func StoragesLoaded(c *gin.Context)

func UnifiedFilteredLogger added in v4.0.9

func UnifiedFilteredLogger(serverType string) gin.HandlerFunc

UnifiedFilteredLogger returns a filtered logger using global configuration serverType: "http" for main HTTP server, "s3" for S3 server

func UploadRateLimiter

func UploadRateLimiter(limiter stream.Limiter) gin.HandlerFunc

Types

type FilteredLoggerConfig added in v4.0.9

type FilteredLoggerConfig struct {
	// SkipPaths is a list of URL paths to skip logging
	SkipPaths []string
	// SkipMethods is a list of HTTP methods to skip logging
	SkipMethods []string
	// SkipPathPrefixes is a list of URL path prefixes to skip logging
	SkipPathPrefixes []string
	// Output is the writer where logs will be written
	Output io.Writer
}

FilteredLoggerConfig defines the configuration for the filtered logger

type ResponseWriterWrapper

type ResponseWriterWrapper struct {
	gin.ResponseWriter
	WrapWriter io.Writer
}

func (*ResponseWriterWrapper) Write

func (w *ResponseWriterWrapper) Write(p []byte) (n int, err error)

Jump to

Keyboard shortcuts

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