routers

package
v0.0.0-...-5893fcd Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Router *gin.Engine

Functions

func AuthPG

func AuthPG() gin.HandlerFunc

AuthPG 认证 权限验证中间件

func CorsHandler

func CorsHandler() gin.HandlerFunc

CorsHandler 跨域中间件

func GetIP

func GetIP(r *http.Request) (ip string)

GetIP 获取ip - X-Real-IP:只包含客户端机器的一个IP,如果为空,某些代理服务器(如Nginx)会填充此header。 - X-Forwarded-For:一系列的IP地址列表,以,分隔,每个经过的代理服务器都会添加一个IP。 - RemoteAddr:包含客户端的真实IP地址。 这是Web服务器从其接收连接并将响应发送到的实际物理IP地址。 但是,如果客户端通过代理连接,它将提供代理的IP地址。

RemoteAddr是最可靠的,但是如果客户端位于代理之后或使用负载平衡器或反向代理服务器时,它将永远不会提供正确的IP地址,因此顺序是先是X-REAL-IP, 然后是X-FORWARDED-FOR,然后是 RemoteAddr。 请注意,恶意用户可以创建伪造的X-REAL-IP和X-FORWARDED-FOR标头。

func HttpMiddleware

func HttpMiddleware() gin.HandlerFunc

HttpMiddleware http中间件

func Routers

func Routers() *gin.Engine

func V1

func V1()

Types

This section is empty.

Jump to

Keyboard shortcuts

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