proxy

package
v0.0.0-...-61732bf Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2018 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package proxy ... TODO(ro) 2017-10-03 add cactus (c)

Package proxy ... TODO(ro) 2017-10-03 add cactus (c)

Index

Constants

View Source
const (
	// DefaultMaxSize is the maximum size we'll proxy.
	DefaultMaxSize = 5 * 1024 * 1024

	// DefaultMaxRedirects is the maximum # of redirects we'll follow.
	DefaultMaxRedirects = 10

	// DefaultRequestTimeout is the request timeout for the client.
	DefaultRequestTimeout = 4 * time.Second

	// DefaultServerName is a name to set our client and Via header to.
	DefaultServerName = "bepress/camo"

	//DefaultKABE is the default keepalives setting for Backends.
	DefaultKABE = false

	//DefaultKAFE is the default keepalives setting for Frontends.
	DefaultKAFE = false
)

Variables

View Source
var ErrFilteredAddress = errors.New("invalid host: filtered host address")

ErrFilteredAddress is an error to be used when we need to detect that an error is of this specific type in order to determine the response code.

View Source
var FilteredIPNetworks = []string{

	"127.0.0.0/8",

	"169.254.0.0/16",

	"224.0.0.0/24",

	"10.0.0.0/8",
	"172.16.0.0/12",
	"192.168.0.0/16",

	"::1/128",

	"fe80::/10",

	"fec0::/10",

	"fc00::/7",

	"::ffff:0:0/96",
}

FilteredIPNetworks contains networks to reject. All special addresses initially.

View Source
var OnExitFlushLoop func()

OnExitFlushLoop is a callback set by tests to detect the state of the flushLoop() goroutine.

Functions

This section is empty.

Types

type Proxy

type Proxy struct {
	BufferPool     httputil.BufferPool
	CheckUnicast   bool
	Decoder        decoder.Decoder
	Filter         *filter.CIDRFilter
	FlushInterval  time.Duration
	LookupIP       ResolverFunc
	MaxRedirects   int
	MaxSize        int64
	RedirFunc      func(*http.Request, []*http.Request) error
	RequestTimeout time.Duration
	ServerName     string
	Transport      http.RoundTripper

	// TODO(ro) 2017-10-02 Do we really care?
	DisableKeepAlivesBE bool
	DisableKeepAlivesFE bool
	// contains filtered or unexported fields
}

Proxy implements the handler for proxying assets.

func MustNew

func MustNew(hmacKey []byte, logger zerolog.Logger, options ...func(*Proxy)) *Proxy

MustNew returns a Proxy handler or panics.

func (*Proxy) ServeHTTP

func (p *Proxy) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements HandlerFunc.

type ResolverFunc

type ResolverFunc func(string) ([]net.IP, error)

ResolverFunc is the net.LookupIP signature so we can fake it in tests.

Jump to

Keyboard shortcuts

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