proxy

package
v0.0.0-...-8488f5b Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2016 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackendListFunc

type BackendListFunc func() []string

BackendListFunc returns a slice of backend hosts (hostname:port).

type ReverseProxy

type ReverseProxy struct {

	// FlushInterval specifies the flush interval
	// to flush to the client while copying the
	// response body.
	// If zero, no periodic flushing is done.
	FlushInterval time.Duration

	// Logger is the logger for the proxy.
	Logger log15.Logger
	// contains filtered or unexported fields
}

ReverseProxy is an HTTP Handler that takes an incoming request and sends it to another server, proxying the response back to the client.

func NewReverseProxy

func NewReverseProxy(bf BackendListFunc, stickyKey *[32]byte, sticky bool, l log15.Logger) *ReverseProxy

NewReverseProxy initializes a new ReverseProxy with a callback to get backends, a stickyKey for encrypting sticky session cookies, and a flag sticky to enable sticky sessions.

func (*ReverseProxy) ServeConn

func (p *ReverseProxy) ServeConn(ctx context.Context, dconn net.Conn)

ServeConn takes an inbound conn and proxies it to a backend.

func (*ReverseProxy) ServeHTTP

func (p *ReverseProxy) ServeHTTP(ctx context.Context, rw http.ResponseWriter, req *http.Request)

ServeHTTP implements http.Handler.

Jump to

Keyboard shortcuts

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