proxied

package
v0.0.0-...-8b1022e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2016 License: Apache-2.0, Apache-2.0 Imports: 15 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var (

	// ErrChainedProxyUnavailable indicates that we weren't able to find a chained
	// proxy.
	ErrChainedProxyUnavailable = "chained proxy unavailable"

	// ErrUnsuccessfulResponseStatus indicates that a response status was unsuccessful
	ErrUnsuccessfulResponseStatus = "unsuccessful response status"
)

Functions

func AsRoundTripper

func AsRoundTripper(fn func(req *http.Request) (*http.Response, error)) http.RoundTripper

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

func PrepareForFronting(req *http.Request, frontedURL string)

PrepareForFronting prepares the given request to be used with domain- fronting.

func SetProxyAddr

func SetProxyAddr(addr eventual.Getter)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL