From 7d84c45579bfb1fc00cd70d86deedf401bf99b01 Mon Sep 17 00:00:00 2001 From: Notealot <714804968@qq.com> Date: Thu, 30 Sep 2021 12:06:53 +0800 Subject: [PATCH] some typo fix --- README.md | 4 ++-- gin.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a24a8b6f..8c833c71 100644 --- a/README.md +++ b/README.md @@ -2208,8 +2208,8 @@ IP can be trusted. They can be IPv4 addresses, IPv4 CIDRs, IPv6 addresses or IPv6 CIDRs. **Attention:** Gin trust all proxies by default if you don't specify a trusted -proxy using this function, **this is not safe**. At the same time, if you don't use -any proxy, you can disable this feature by use `Engine.SetTrustedProxies(nil)`, +proxy using the function above, **this is NOT safe**. At the same time, if you don't +use any proxy, you can disable this feature by using `Engine.SetTrustedProxies(nil)`, then `Context.ClientIP()` will return the remote address directly to avoid some unnecessary computation. diff --git a/gin.go b/gin.go index 153d0157..8083f893 100644 --- a/gin.go +++ b/gin.go @@ -122,7 +122,7 @@ type Engine struct { // List of headers used to obtain the client IP when // `(*gin.Engine).ForwardedByClientIP` is `true` and // `(*gin.Context).Request.RemoteAddr` is matched by at least one of the - // network origins of list set by `(*gin.Engine).SetTrustedProxies()`. + // network origins of list defined by `(*gin.Engine).SetTrustedProxies()`. RemoteIPHeaders []string // If set to a constant of value gin.Platform*, trusts the headers set by @@ -393,7 +393,7 @@ func (engine *Engine) SetTrustedProxies(trustedProxies []string) error { return engine.parseTrustedProxies() } -// isUnsafeTrustedProxies equals Engine.trustedCIDRs and defaultTrustedCIDRs, it's not safe if true +// isUnsafeTrustedProxies compares Engine.trustedCIDRs and defaultTrustedCIDRs, it's not safe if equal (returns true) func (engine *Engine) isUnsafeTrustedProxies() bool { return reflect.DeepEqual(engine.trustedCIDRs, defaultTrustedCIDRs) }