This commit is contained in:
Manu Mtz.-Almeida 2021-02-08 14:22:58 +01:00
parent 6f562eafa8
commit ffe7ac09d0

View File

@ -2143,15 +2143,13 @@ func main() {
router.TrustedProxies = []string{"192.168.1.2"}
router.GET("/", func(c *gin.Context) {
// If the client is 192.168.1.2, use the X-Forwarded-For
// header to deduce the original client IP from the trust-
// worthy parts of that header.
// Otherwise, simply return the direct client IP
fmt.Printf("ClientIP: %s\n", c.ClientIP())
})
router.Run()
fmt.Printf("ClientIP: %s\n", c.ClientIP())
})
router.Run()
}
```