Documentation ¶
Overview ¶
Package proxied provides http.Client implementations that use various combinations of chained and direct domain-fronted proxies.
Remember to call SetProxyAddr before obtaining an http.Client.
Index ¶
- Variables
- func AsRoundTripper(fn func(req *http.Request) (*http.Response, error)) http.RoundTripper
- func ChainedNonPersistent(rootCA string) (http.RoundTripper, error)
- func ChainedPersistent(rootCA string) (http.RoundTripper, error)
- func ChainedThenFronted() http.RoundTripper
- func ParallelPreferChained() http.RoundTripper
- func PrepareForFronting(req *http.Request, frontedURL string)
- func SetProxyAddr(addr eventual.Getter)
Constants ¶
This section is empty.
Variables ¶
var ( // proxy. ErrChainedProxyUnavailable = "chained proxy unavailable" // ErrUnsuccessfulResponseStatus indicates that a response status was unsuccessful ErrUnsuccessfulResponseStatus = "unsuccessful response status" )
Functions ¶
func AsRoundTripper ¶
AsRoundTripper turns the given function into an http.RoundTripper.
func ChainedNonPersistent ¶
func ChainedNonPersistent(rootCA string) (http.RoundTripper, error)
ChainedNonPersistent creates an http.RoundTripper that proxies through chained servers and does not use keepalive connections. If rootCA is specified, the RoundTripper will validate the server's certificate on TLS connections against that RootCA.
func ChainedPersistent ¶
func ChainedPersistent(rootCA string) (http.RoundTripper, error)
ChainedPersistent creates an http.RoundTripper that uses keepalive connectionspersists and proxies through chained servers. If rootCA is specified, the RoundTripper will validate the server's certificate on TLS connections against that RootCA.
func ChainedThenFronted ¶
func ChainedThenFronted() http.RoundTripper
ChainedThenFronted creates a new http.RoundTripper that attempts to send requests first through a chained server and then falls back to using a direct fronted server if the chained route didn't work.
func ParallelPreferChained ¶
func ParallelPreferChained() http.RoundTripper
ParallelPreferChained creates a new http.RoundTripper that attempts to send requests through both chained and direct fronted routes in parallel. Once a chained request succeeds, subsequent requests will only go through Chained servers unless and until a request fails, in which case we'll start trying fronted requests again.
func PrepareForFronting ¶
PrepareForFronting prepares the given request to be used with domain- fronting.
func SetProxyAddr ¶
SetProxyAddr sets the eventual.Getter that's used to determine the proxy's address. This MUST be called before attempting to use the proxied package.
Types ¶
This section is empty.