validateHeader() — gin Function Reference
Architecture documentation for the validateHeader() function in gin.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 14fd4b3a_88ba_72fd_e1f4_e06462aef916["validateHeader()"] f3faef48_2c81_36e4_bab9_c2c06066e309["isTrustedProxy()"] 14fd4b3a_88ba_72fd_e1f4_e06462aef916 -->|calls| f3faef48_2c81_36e4_bab9_c2c06066e309 style 14fd4b3a_88ba_72fd_e1f4_e06462aef916 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
gin.go lines 482–501
func (engine *Engine) validateHeader(header string) (clientIP string, valid bool) {
if header == "" {
return "", false
}
items := strings.Split(header, ",")
for i := len(items) - 1; i >= 0; i-- {
ipStr := strings.TrimSpace(items[i])
ip := net.ParseIP(ipStr)
if ip == nil {
break
}
// X-Forwarded-For is appended by proxy
// Check IPs in reverse order and stop when find untrusted proxy
if (i == 0) || (!engine.isTrustedProxy(ip)) {
return ipStr, true
}
}
return "", false
}
Domain
Subdomains
Calls
Source
Frequently Asked Questions
What does validateHeader() do?
validateHeader() is a function in the gin codebase.
What does validateHeader() call?
validateHeader() calls 1 function(s): isTrustedProxy.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free