Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ForwardProxy ¶
type ForwardProxy struct { // Interface from which the request originated. This may not always be // populated, and when processing X-Forwarded-* and X-Real-IP headers, this // will always contain localhost. // // Forwarded header: "by" Interface AddrSpec // Source address initiating the request. May be a chain of proxies. Source []AddrSpec // Host header. Host string // Port used to connect to us. Port int // Protocol; usually "http" or "https" in most cases. Protocol string }
func Parse ¶
func Parse(r *http.Request) (fp *ForwardProxy)
Parse, in order, the following headers: Forwarded, X-Forwarded-For, and X-Real-IP. Precedence is given in aforementioned list; if a previous header is present, any additional headers are ignored and the first match is returned. For instance, if "Forwarded" is present, no further headers will be processed.
func (*ForwardProxy) Client ¶
func (fp *ForwardProxy) Client() AddrSpec
Client returns the source client that initiated the request or an empty IP address if no forwarded chain exists via the request headers.
Use HasProxy() first to determine if an intermediate proxy was present via any of the supported fowarding headers.
func (*ForwardProxy) HasProxy ¶
func (fp *ForwardProxy) HasProxy() bool
func (*ForwardProxy) MakeHeader ¶
func (fp *ForwardProxy) MakeHeader() string
Click to show internal directories.
Click to hide internal directories.