handlers

package
Version: v0.0.0-...-2fc2a81 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: Apache-2.0, BSD-2-Clause-Views, BSD-3-Clause, MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CfInstanceIdHeader = "X-CF-InstanceID"
	CfAppInstance      = "X-CF-APP-INSTANCE"
)
View Source
const (
	B3TraceIdHeader      = "X-B3-TraceId"
	B3SpanIdHeader       = "X-B3-SpanId"
	B3ParentSpanIdHeader = "X-B3-ParentSpanId"
)
View Source
const (
	VcapRequestIdHeader = "X-Vcap-Request-Id"
)

Variables

This section is empty.

Functions

func GetEndpoint

func GetEndpoint(ctx context.Context) (*route.Endpoint, error)

func IsTcpUpgrade

func IsTcpUpgrade(request *http.Request) bool

func IsWebSocketUpgrade

func IsWebSocketUpgrade(request *http.Request) bool

func NewAccessLog

func NewAccessLog(
	accessLogger accesslog.AccessLogger,
	extraHeadersToLog []string,
	logger logger.Logger,
) negroni.Handler

NewAccessLog creates a new handler that handles logging requests to the access log

func NewClientCert

func NewClientCert(skipSanitization, forceDeleteHeader func(req *http.Request) (bool, error), forwardingMode string, logger logger.Logger) negroni.Handler

func NewHTTPStartStop

func NewHTTPStartStop(emitter dropsonde.EventEmitter, logger logger.Logger) negroni.Handler

NewHTTPStartStop creates a new handler that handles emitting frontent HTTP StartStop events

func NewHealthcheck

func NewHealthcheck(heartbeatOK *int32, logger logger.Logger) http.Handler

func NewLookup

func NewLookup(registry registry.Registry, rep metrics.ProxyReporter, logger logger.Logger) negroni.Handler

NewLookup creates a handler responsible for looking up a route.

func NewProtocolCheck

func NewProtocolCheck(logger logger.Logger) negroni.Handler

NewProtocolCheck creates a handler responsible for checking the protocol of the request

func NewProxyHealthcheck

func NewProxyHealthcheck(userAgent string, heartbeatOK *int32, logger logger.Logger) negroni.Handler

NewHealthcheck creates a handler that responds to healthcheck requests. If userAgent is set to a non-empty string, it will use that user agent to differentiate between healthcheck requests and non-healthcheck requests. Otherwise, it will treat all requests as healthcheck requests.

func NewProxyWriter

func NewProxyWriter(logger logger.Logger) negroni.Handler

NewProxyWriter creates a handler responsible for setting a proxy responseWriter on the request and response

func NewReporter

func NewReporter(reporter metrics.ProxyReporter, logger logger.Logger) negroni.Handler

NewReporter creates a new handler that handles reporting backend responses to metrics

func NewRequestInfo

func NewRequestInfo() negroni.Handler

NewRequestInfo creates a RequestInfoHandler

func NewRouteService

func NewRouteService(config *routeservice.RouteServiceConfig, routeRegistry registry.Registry, logger logger.Logger) negroni.Handler

NewRouteService creates a handler responsible for handling route services

func NewVcapRequestIdHeader

func NewVcapRequestIdHeader(logger logger.Logger) negroni.Handler

Types

type RequestInfo

type RequestInfo struct {
	StartedAt, StoppedAt   time.Time
	RoutePool              *route.Pool
	RouteEndpoint          *route.Endpoint
	ProxyResponseWriter    utils.ProxyResponseWriter
	RouteServiceURL        *url.URL
	IsInternalRouteService bool

	BackendReqHeaders http.Header
}

RequestInfo stores all metadata about the request and is used to pass informaton between handlers

func ContextRequestInfo

func ContextRequestInfo(req *http.Request) (*RequestInfo, error)

ContextRequestInfo gets the RequestInfo from the request Context

type RequestInfoHandler

type RequestInfoHandler struct{}

RequestInfoHandler adds a RequestInfo to the context of all requests that go through this handler

func (*RequestInfoHandler) ServeHTTP

func (r *RequestInfoHandler) ServeHTTP(w http.ResponseWriter, req *http.Request, next http.HandlerFunc)

type RouteService

type RouteService struct {
	// contains filtered or unexported fields
}

func (*RouteService) ArrivedViaRouteService

func (r *RouteService) ArrivedViaRouteService(req *http.Request) (bool, error)

func (*RouteService) ServeHTTP

func (r *RouteService) ServeHTTP(rw http.ResponseWriter, req *http.Request, next http.HandlerFunc)

type XForwardedProto

type XForwardedProto struct {
	SkipSanitization         func(req *http.Request) (bool, error)
	ForceForwardedProtoHttps bool
	SanitizeForwardedProto   bool
	Logger                   logger.Logger
}

func (*XForwardedProto) ServeHTTP

func (h *XForwardedProto) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

type Zipkin

type Zipkin struct {
	// contains filtered or unexported fields
}

Zipkin is a handler that sets Zipkin headers on requests

func NewZipkin

func NewZipkin(enabled bool, headersToLog []string, logger logger.Logger) *Zipkin

NewZipkin creates a new handler that sets Zipkin headers on requests

func (*Zipkin) HeadersToLog

func (z *Zipkin) HeadersToLog() []string

HeadersToLog returns headers that should be logged in the access logs and includes Zipkin headers in this set if necessary

func (*Zipkin) ServeHTTP

func (z *Zipkin) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL