prepareTrustedCIDRs() — gin Function Reference
Architecture documentation for the prepareTrustedCIDRs() function in gin.go from the gin codebase.
Entity Profile
Dependency Diagram
graph TD 88289ef4_30e0_335e_405f_694ce97577fe["prepareTrustedCIDRs()"] 8966c409_35df_9265_c2a6_45974fac0271["parseTrustedProxies()"] 8966c409_35df_9265_c2a6_45974fac0271 -->|calls| 88289ef4_30e0_335e_405f_694ce97577fe 7e035181_4453_0bbc_4640_6c9df038ab22["parseIP()"] 88289ef4_30e0_335e_405f_694ce97577fe -->|calls| 7e035181_4453_0bbc_4640_6c9df038ab22 style 88289ef4_30e0_335e_405f_694ce97577fe fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
gin.go lines 414–441
func (engine *Engine) prepareTrustedCIDRs() ([]*net.IPNet, error) {
if engine.trustedProxies == nil {
return nil, nil
}
cidr := make([]*net.IPNet, 0, len(engine.trustedProxies))
for _, trustedProxy := range engine.trustedProxies {
if !strings.Contains(trustedProxy, "/") {
ip := parseIP(trustedProxy)
if ip == nil {
return cidr, &net.ParseError{Type: "IP address", Text: trustedProxy}
}
switch len(ip) {
case net.IPv4len:
trustedProxy += "/32"
case net.IPv6len:
trustedProxy += "/128"
}
}
_, cidrNet, err := net.ParseCIDR(trustedProxy)
if err != nil {
return cidr, err
}
cidr = append(cidr, cidrNet)
}
return cidr, nil
}
Domain
Subdomains
Calls
Called By
Source
Frequently Asked Questions
What does prepareTrustedCIDRs() do?
prepareTrustedCIDRs() is a function in the gin codebase.
What does prepareTrustedCIDRs() call?
prepareTrustedCIDRs() calls 1 function(s): parseIP.
What calls prepareTrustedCIDRs()?
prepareTrustedCIDRs() is called by 1 function(s): parseTrustedProxies.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free