mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-28 13:08:20 +08:00
Merge 8b3e41da2987f0ea224513eb3bdeeb8e7f7906c7 into c221133ee80c46e3a6c50717ca6f1b41d4ab7711
This commit is contained in:
commit
7f6a872075
@ -966,6 +966,15 @@ func (c *Context) RemoteIP() string {
|
||||
return ip
|
||||
}
|
||||
|
||||
// FromTrustProxy check if the request is from a trusted proxy server
|
||||
func (c *Context) FromTrustProxy() bool {
|
||||
remoteIP := net.ParseIP(c.RemoteIP())
|
||||
if remoteIP == nil {
|
||||
return false
|
||||
}
|
||||
return c.engine.isTrustedProxy(remoteIP)
|
||||
}
|
||||
|
||||
// ContentType returns the Content-Type header of the request.
|
||||
func (c *Context) ContentType() string {
|
||||
return filterFlags(c.requestHeader("Content-Type"))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user