refactor🎨:注释未使用的对象
This commit is contained in:
1 parent
d32751ea5d
commit
3358eeb54c
6 files changed
+19
-14
No files matched your search
+3
-4
@@ -1,16 +1,15 @@
|
||||
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")
|
||||
@@ -24,6 +23,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
|
||||
}
|
||||
Reference in new issue
Block a user