MCPcopy Index your code
hub / github.com/labstack/echo / trust

Method trust

ip.go:182–198  ·  view source on GitHub ↗
(ip net.IP)

Source from the content-addressed store, hash-verified

180}
181
182func (c *ipChecker) trust(ip net.IP) bool {
183 if c.trustLoopback && ip.IsLoopback() {
184 return true
185 }
186 if c.trustLinkLocal && ip.IsLinkLocalUnicast() {
187 return true
188 }
189 if c.trustPrivateNet && ip.IsPrivate() {
190 return true
191 }
192 for _, trustedRange := range c.trustExtraRanges {
193 if trustedRange.Contains(ip) {
194 return true
195 }
196 }
197 return false
198}
199
200// IPExtractor is a function to extract IP addr from http.Request.
201// Set appropriate one to Echo#IPExtractor.

Callers 7

TestTrustIPRangeFunction · 0.80
TestTrustPrivateNetFunction · 0.80
TestTrustLinkLocalFunction · 0.80
TestTrustLoopbackFunction · 0.80
ExtractIPFromXFFHeaderFunction · 0.80

Calls

no outgoing calls

Tested by 5

TestTrustIPRangeFunction · 0.64
TestTrustPrivateNetFunction · 0.64
TestTrustLinkLocalFunction · 0.64
TestTrustLoopbackFunction · 0.64