This commit is contained in:
Lanco 2021-07-02 09:58:43 +08:00 committed by GitHub
parent 690aa2b1b9
commit 372cc4a010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -732,7 +732,7 @@ func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (e
// If the headers are nots syntactically valid OR the remote IP does not correspong to a trusted proxy, // If the headers are nots syntactically valid OR the remote IP does not correspong to a trusted proxy,
// the remote IP (coming form Request.RemoteAddr) is returned. // the remote IP (coming form Request.RemoteAddr) is returned.
func (c *Context) ClientIP() string { func (c *Context) ClientIP() string {
// Check if we're running on a tursted platform // Check if we're running on a trusted platform
switch c.engine.TrustedPlatform { switch c.engine.TrustedPlatform {
case PlatformGoogleAppEngine: case PlatformGoogleAppEngine:
if addr := c.requestHeader("X-Appengine-Remote-Addr"); addr != "" { if addr := c.requestHeader("X-Appengine-Remote-Addr"); addr != "" {