Revert "refactor🎨:注释未使用的对象"

This reverts commit 3358eeb54c.
This commit is contained in:
zhangwenjian committed 2021-06-17 11:28:51 +08:00
1 parent 3358eeb54c
commit a0b7d9969a
6 files changed
+14 -19

No files matched your search

+4 -3
View File
@@ -1,15 +1,16 @@
package common
import (
"fmt"
"github.com/gin-gonic/gin"
"strings"
)
func GetClientIP(c *gin.Context) string {
ClientIP := c.ClientIP()
//fmt.Println("ClientIP:", ClientIP)
fmt.Println("ClientIP:", ClientIP)
RemoteIP, _ := c.RemoteIP()
//fmt.Println("RemoteIP:", RemoteIP)
fmt.Println("RemoteIP:", RemoteIP)
ip := c.Request.Header.Get("X-Forwarded-For")
if strings.Contains(ip, "127.0.0.1") || ip == "" {
ip = c.Request.Header.Get("X-real-ip")
@@ -23,6 +24,6 @@ func GetClientIP(c *gin.Context) string {
if ClientIP != "127.0.0.1" {
ip = ClientIP
}
//fmt.Println("ip:", ip)
fmt.Println("ip:", ip)
return ip
}