handler

package
v0.0.0-...-358f329 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: MIT Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EndpointsHandler

func EndpointsHandler(srv *HailoServer) http.HandlerFunc

EndpointsHandler serves up app-pinning configuration to apps

func Handler

func Handler(srv *HailoServer) http.HandlerFunc

Handler will handle an HTTP request, deciding what to do with it

func RpcHandler

func RpcHandler(srv *HailoServer) http.HandlerFunc

RpcHandler will handle an HTTP request to /rpc (specifically H2 RPC)

Types

type CORSHandler

type CORSHandler struct {
	Handler http.Handler
}

func (*CORSHandler) ServeHTTP

func (h *CORSHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type HailoServer

type HailoServer struct {
	Tomb              *ptomb.Tomb // used to kill the server
	CORSHandler       *CORSHandler
	HTTPServer        *http.Server
	RealIPHandler     *RealIPHandler
	ThrottlingHandler *ThrottlingHandler
	Control           *controlplane.ControlPlane
	Monitor           *statusmonitor.StatusMonitor
}

func NewServer

func NewServer(accessLogWriter io.Writer) *HailoServer

Creates a new server, with the correct timeouts, throttling, etc.

func (*HailoServer) Kill

func (h *HailoServer) Kill(reason error)

type PCIFilter

type PCIFilter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewPCIFilter

func NewPCIFilter(h http.Handler, srv *HailoServer) *PCIFilter

func (*PCIFilter) Forward

func (f *PCIFilter) Forward(rw http.ResponseWriter, r *http.Request)

func (*PCIFilter) IsSensitiveRequest

func (f *PCIFilter) IsSensitiveRequest(req *http.Request) bool

func (*PCIFilter) ServeHTTP

func (f *PCIFilter) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type RealIPHandler

type RealIPHandler struct {
	Handler http.Handler
}

RealIPHandler ensures that the request's RemoteAddr field is correctly populated with the actual client's IP address, rather than that of any intermediary.

func (*RealIPHandler) ServeHTTP

func (h *RealIPHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

type ThrottlingHandler

type ThrottlingHandler struct {
	Handler http.Handler
	// contains filtered or unexported fields
}

A ThrottlingHandler is a decorator around another HTTP handler that implements our API throttling behaviour. It buckets inbound requests, records statistics about request volume to each bucket, and throttles full buckets. If a request is throttled, it will proceed no further up the handler chain.

func NewThrottlingHandler

func NewThrottlingHandler(h http.Handler, srv *HailoServer) *ThrottlingHandler

func (*ThrottlingHandler) ServeHTTP

func (t *ThrottlingHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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