Documentation ¶
Index ¶
- Constants
- func AccessLog() gin.HandlerFunc
- func Cors(c *gin.Context)
- func HandleErrors(c *gin.Context)
- func IPLimiter(limit int, expire time.Duration) gin.HandlerFunc
- func Init(namespace string)
- func Logging() gin.HandlerFunc
- func MaxLimiter(n int) gin.HandlerFunc
- func NoCache(c *gin.Context)
- func Prom(opts ...PromOpt) gin.HandlerFunc
- func PromHandler(handler http.Handler) gin.HandlerFunc
- func Secure(c *gin.Context)
- func Timeout(t time.Duration) gin.HandlerFunc
- func VerifySign(secretKey string, opts ...VerifyOpt) gin.HandlerFunc
- type PromOpt
- type PromOpts
- type VerifyOpt
- type VerifyOpts
Constants ¶
View Source
const ( // HeaderSignToken 签名验证 Authorization,Header 中传递的参数 HeaderSignToken = "Auth" // HeaderSignTokenDate 签名验证 Date,Header 中传递的参数 HeaderSignTokenDate = "Auth-Date" // HeaderSignTokenTimeout 签名有效期为 1 分钟 HeaderSignTokenTimeout = time.Minute )
Variables ¶
This section is empty.
Functions ¶
func Logging ¶
func Logging() gin.HandlerFunc
Logging is a middleware function that logs the request.
func NoCache ¶
NoCache is a middleware function that appends headers to prevent the client from caching the HTTP response.
func Prom ¶
func Prom(opts ...PromOpt) gin.HandlerFunc
Prom returns a gin.HandlerFunc for exporting some Web metrics
func PromHandler ¶
func PromHandler(handler http.Handler) gin.HandlerFunc
PromHandler wrappers the standard http.Handler to gin.HandlerFunc
func VerifySign ¶
func VerifySign(secretKey string, opts ...VerifyOpt) gin.HandlerFunc
VerifySign 验证签名
Types ¶
type PromOpt ¶
type PromOpt func(opts *PromOpts)
PromOpt 设置 PromOpts 选项
func WithEndpointLabel ¶
WithEndpointLabel 设置 EndpointLabel
type PromOpts ¶
type PromOpts struct { Namespace string ExcludeRegexStatus string ExcludeRegexEndpoint string ExcludeRegexMethod string EndpointLabelFn func(c *gin.Context) string }
PromOpts represents the Prometheus middleware Options. It is used for filtering labels by regex.
type VerifyOpts ¶
type VerifyOpts struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.