diff --git a/common/ip.go b/common/ip.go index ab341483..bc4d9ef4 100644 --- a/common/ip.go +++ b/common/ip.go @@ -8,7 +8,7 @@ import ( func GetClientIP(c *gin.Context) string { ClientIP := c.ClientIP() //fmt.Println("ClientIP:", ClientIP) - RemoteIP, _ := c.RemoteIP() + RemoteIP := c.RemoteIP() //fmt.Println("RemoteIP:", RemoteIP) ip := c.Request.Header.Get("X-Forwarded-For") if strings.Contains(ip, "127.0.0.1") || ip == "" { @@ -17,8 +17,8 @@ func GetClientIP(c *gin.Context) string { if ip == "" { ip = "127.0.0.1" } - if RemoteIP.String() != "127.0.0.1" { - ip = RemoteIP.String() + if RemoteIP != "127.0.0.1" { + ip = RemoteIP } if ClientIP != "127.0.0.1" { ip = ClientIP