middleware_http

package
v0.0.0-...-6cf1638 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: MulanPSL-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessMode

func AccessMode() gin.HandlerFunc

AccessMode 匹配前缀或域名,判断该http请求是否合法被代理

func FlowQpsCount

func FlowQpsCount() gin.HandlerFunc

FlowQpsCount 统计QPS

func FlowQpsLimit

func FlowQpsLimit() gin.HandlerFunc

func FlowReqBreaker

func FlowReqBreaker() gin.HandlerFunc

FlowReqBreaker 是一个Gin中间件,它使用gobreaker来实现熔断器。

func FlowReqCount

func FlowReqCount() gin.HandlerFunc

FlowReqCount 统计各服务的请求量

func JwtAuthToken

func JwtAuthToken() gin.HandlerFunc

JwtAuthToken 校验token合法性

func JwtQpdLimit

func JwtQpdLimit() gin.HandlerFunc

func JwtQpsLimit

func JwtQpsLimit() gin.HandlerFunc

func ReverseProxy

func ReverseProxy() gin.HandlerFunc

ReverseProxy 创建并返回一个gin.HandlerFunc, 该中间件用于根据服务名动态发现后端服务,并通过负载均衡策略反向代理请求到相应的后端服务。

func StripUri

func StripUri() gin.HandlerFunc

StripUri uri去掉前缀

func UrlRewrite

func UrlRewrite() gin.HandlerFunc

UrlRewrite url重写

Types

type InterceptingResponseWriter

type InterceptingResponseWriter struct {
	http.ResponseWriter // 原始的 ResponseWriter
	// contains filtered or unexported fields
}

InterceptingResponseWriter 是一个自定义的 ResponseWriter,用于捕获响应数据。

func (*InterceptingResponseWriter) Flush

func (irw *InterceptingResponseWriter) Flush()

Flush 方法,用于支持流式传输,如果底层的 ResponseWriter 支持的话。

func (*InterceptingResponseWriter) Write

func (irw *InterceptingResponseWriter) Write(b []byte) (int, error)

Write 方法重写,将数据同时写入原始的 ResponseWriter 和缓冲区。

Jump to

Keyboard shortcuts

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