mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-13 09:18:15 +08:00
Compare commits
2 Commits
ff56a55ec3
...
a48962d5d3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a48962d5d3 | ||
|
|
8b3e41da29 |
@ -1015,6 +1015,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