middleware

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORS

func CORS() gin.HandlerFunc

CORS gin middleware cors

func GinProxy

func GinProxy[Rsp any](c *gin.Context, host, uri string) (rsp Rsp, err error)

GinProxy gin request proxy and get rsp

func GinPureProxy

func GinPureProxy(c *gin.Context, host string)

GinPureProxy gin request proxy

func Limiter

func Limiter(appName string, rl *limiter.RateLimiter) gin.HandlerFunc

Limiter gin middleware limiter if rl is nil, default Bucket = 1000, Rate = 1000

func Recovery

func Recovery() gin.HandlerFunc

Recovery gin middleware recovery

Types

type HttpRsp

type HttpRsp[V any] struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    V      `json:"data,omitempty"`
}

type RecoveryInfo

type RecoveryInfo struct {
	Time        string `json:"time"`
	RequestURI  string `json:"request_uri"`
	Body        string `json:"body"`
	RequestInfo string `json:"request_info"`
	Err         any    `json:"error"`
	Stack       string `json:"stack"`
}

Jump to

Keyboard shortcuts

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