Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CFConnectingIP is an HeaderParser. // https://support.cloudflare.com/hc/en-us/articles/206776727-What-is-True-Client-IP- CFConnectingIP = HeaderParser{"CF-Connecting-IP", parseXForwardedForHeader} // TrueClientIP is an HeaderParser. TrueClientIP = HeaderParser{"True-Client-IP", parseXForwardedForHeader} // XForwardedFor is an HeaderParser. XForwardedFor = HeaderParser{"X-Forwarded-For", parseXForwardedForHeader} // Forwarded is an HeaderParser. Forwarded = HeaderParser{"Forwarded", parseForwardedHeader} // XRealIP is an HeaderParser. XRealIP = HeaderParser{"X-Real-IP", parseXRealIPHeader} // DefaultHeaderParser is a list of headers and corresponding parsers to look up the real client IP. // They will be check in order, the first non-empty one will be picked, // or else the remote address is selected. DefaultHeaderParser = []HeaderParser{ CFConnectingIP, TrueClientIP, XForwardedFor, Forwarded, XRealIP, } )
Functions ¶
Types ¶
type Filter ¶
type Filter interface { // Update updates the filter list for given plain IP addresses and IP address ranges (v4 and v6). Update([]string, []string, []Range, []Range) // Ignore reports whether an IP address should be ignored. Ignore(string) bool }
Filter filters requests using the IP address.
type HeaderParser ¶
type HeaderParser struct { Header string Parser ParseHeaderFunc }
HeaderParser parses a header to extract the real client IP address.
type ParseHeaderFunc ¶
ParseHeaderFunc parses and validates an IP address from a header. It must return an empty string if the header or contained IP address is invalid.
type Udger ¶
type Udger struct {
// contains filtered or unexported fields
}
Udger implements the Filter interface.
func (*Udger) DownloadAndUpdate ¶
DownloadAndUpdate downloads and updates the IP list from udger.com.
Click to show internal directories.
Click to hide internal directories.