Documentation
¶
Overview ¶
Package clientaddr decides which address a request came from, for the audit log (R-379, R-380), and carries it on the request's context to the audit writer.
A leaf: the API, the proxy and the audit writer all import it, and it imports nothing of Pando's.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Trusted ¶
type Trusted struct {
// contains filtered or unexported fields
}
Trusted is the set of proxies whose X-Forwarded-For is believed. The zero value trusts nobody, which records the connecting peer — what Pando did before issue #129.
func Parse ¶
Parse reads a comma- or space-separated list of addresses and CIDRs. A bare address is a single host. An empty list trusts nobody.
func (Trusted) Middleware ¶
Middleware records each request's addresses on its context.
func (Trusted) Resolve ¶
Resolve returns the client's address and the connecting peer's.
The peer is RemoteAddr's host. When the peer is trusted, X-Forwarded-For is read from the right and the first address that is not itself trusted is the client: the left of the header is whatever the client sent, and each trusted hop appends on the right. A hop that cannot be read ends the chain, and a chain of only trusted hops ends at its left-most.