gin

package module
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BasicAuthHandler

func BasicAuthHandler(userid, passwd string, next func(ctx *gin.Context)) gin.HandlerFunc

BasicAuthHandler returns an HTTP handler function that performs basic authentication using the provided userid and password. It checks the request's basic authentication credentials and responds with a 401 Unauthorized status if the credentials are invalid.

Types

type MetricAdapter

type MetricAdapter struct {
	// contains filtered or unexported fields
}

MetricAdapter is the Gin MetricAdapter.

func NewMetricsAdapter

func NewMetricsAdapter(reqKey string) *MetricAdapter

NewMetricsAdapter is the default Gin MetricAdapter.

func (*MetricAdapter) Code

func (obj *MetricAdapter) Code(ctx *gin.Context) int

func (*MetricAdapter) Handler

func (obj *MetricAdapter) Handler(ctx *gin.Context) string

func (*MetricAdapter) Method

func (obj *MetricAdapter) Method(ctx *gin.Context) string

func (*MetricAdapter) Middleware

func (obj *MetricAdapter) Middleware(metrics metrics.Metrics) gin.HandlerFunc

Middleware is the Gin MetricAdapter function that logs Handler requests and their details.

It takes the following parameters: enable: bool, whether to enable the middleware or not. reqKey: string, the key to retrieve the received bytes from the context.

func (*MetricAdapter) Reporter

func (obj *MetricAdapter) Reporter(ctx *gin.Context, start time.Time, requestBytes int64) metrics.MetricData

Reporter is the Gin MetricAdapter function that logs Handler requests and their details.

func (*MetricAdapter) RequestBytes

func (obj *MetricAdapter) RequestBytes(ctx *gin.Context) int64

func (*MetricAdapter) ResponseBytes

func (obj *MetricAdapter) ResponseBytes(ctx *gin.Context) int64

Jump to

Keyboard shortcuts

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