diff --git a/context.go b/context.go index 5716318e..725947ba 100644 --- a/context.go +++ b/context.go @@ -796,7 +796,7 @@ func (c *Context) ClientIP() string { if trusted && c.engine.ForwardedByClientIP && c.engine.RemoteIPHeaders != nil { for _, headerName := range c.engine.RemoteIPHeaders { - ip, valid := c.engine.validateHeader(c.requestHeader(headerName)) + ip, valid := c.engine.getTrustedClientIP(c.requestHeader(headerName)) if valid { return ip } diff --git a/gin.go b/gin.go index f95e5dda..3cb9aced 100644 --- a/gin.go +++ b/gin.go @@ -454,8 +454,8 @@ func (engine *Engine) isTrustedProxy(ip net.IP) bool { return false } -// validateHeader will parse X-Forwarded-For header and return the trusted client IP address -func (engine *Engine) validateHeader(header string) (clientIP string, valid bool) { +// getTrustedClientIP will parse X-Forwarded-For header and return the trusted client IP address +func (engine *Engine) getTrustedClientIP(header string) (clientIP string, valid bool) { if header == "" { return "", false }