Documentation ¶
Index ¶
- Constants
- func AuthMiddleware() gin.HandlerFunc
- func Logging() gin.HandlerFunc
- func NoCache(c *gin.Context)
- func Options(c *gin.Context)
- func Prom(promOpts *PromOpts) gin.HandlerFunc
- func PromHandler(handler http.Handler) gin.HandlerFunc
- func RequestID() gin.HandlerFunc
- func Secure(c *gin.Context)
- func SignMd5Middleware() gin.HandlerFunc
- func Trace() gin.HandlerFunc
- type PromOpts
- type RequestLabelMappingFn
Constants ¶
View Source
const (
// DefaultServiceName service name
DefaultServiceName = "snake"
)
Variables ¶
This section is empty.
Functions ¶
func Logging ¶
func Logging() gin.HandlerFunc
Logging is a middleware function that logs the each request.
func NoCache ¶
NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.
func Options ¶
Options is a middleware function that appends headers for options requests and aborts then exits the middleware chain and ends the request.
func Prom ¶ added in v1.3.0
func Prom(promOpts *PromOpts) gin.HandlerFunc
Prom returns a gin.HandlerFunc for exporting some Web metrics
func PromHandler ¶ added in v1.3.0
func PromHandler(handler http.Handler) gin.HandlerFunc
PromHandler wrappers the standard http.Handler to gin.HandlerFunc
func SignMd5Middleware ¶ added in v1.2.0
func SignMd5Middleware() gin.HandlerFunc
SignMd5Middleware md5 签名校验中间件
func Trace ¶ added in v1.3.0
func Trace() gin.HandlerFunc
Types ¶
type PromOpts ¶ added in v1.3.0
type PromOpts struct { ExcludeRegexStatus string ExcludeRegexEndpoint string ExcludeRegexMethod string EndpointLabelMappingFn RequestLabelMappingFn }
PromOpts represents the Prometheus middleware Options. It is used for filtering labels by regex.
func NewDefaultOpts ¶ added in v1.3.0
func NewDefaultOpts() *PromOpts
NewDefaultOpts return the default ProOpts
type RequestLabelMappingFn ¶ added in v1.3.0
Click to show internal directories.
Click to hide internal directories.