web

package
v0.0.0-...-3ce1eab Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: Apache-2.0, BSD-3-Clause, MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSelector

func BuildSelector(v url.Values) ([]*loggregator_v2.Selector, error)

BuildSelector returns a slice of v2 loggregator Selectors generated from the given query parameters

func ReadHandler

func ReadHandler(
	lp LogsProvider,
	heartbeat time.Duration,
	streamTimeout time.Duration,
) http.HandlerFunc

ReadHandler returns a http.Handler that will serve logs over server sent events. Logs are streamed from the logs provider and written to the client connection. The format of the envelopes is as follows:

data: <JSON ENVELOPE BATCH>

data: <JSON ENVELOPE BATCH>

Types

type CFAuthMiddlewareProvider

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

CFAuthMiddlewareProvider defines middleware for authenticating CF clients

func NewCFAuthMiddlewareProvider

func NewCFAuthMiddlewareProvider(
	oauth2Reader Oauth2ClientReader,
	logAuthorizer LogAuthorizer,
) CFAuthMiddlewareProvider

NewCFAuthMiddlewareProvider creates a CFAuthMiddlewareProvider

func (CFAuthMiddlewareProvider) Middleware

Middleware provides an http.Handler for checking access to to logs

type Handler

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

Handler defines a struct for servering http endpoints

func NewHandler

func NewHandler(lp LogsProvider, streamTimeout time.Duration) *Handler

NewHandler returns a configured HTTP Handler

func (Handler) ServeHTTP

func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP satisfies the http.ServeHTTP interface and forwards requests to the Handler's mux

type LogAuthorizer

type LogAuthorizer interface {
	IsAuthorized(sourceID, token string) bool
	AvailableSourceIDs(token string) []string
}

LogAuthorizer defines the interface for validating and providing access to logs

type LogsProvider

type LogsProvider interface {
	Stream(ctx context.Context, req *loggregator_v2.EgressBatchRequest) Receiver
}

LogsProvder defines the interface for opening streams to the logs provider

type Oauth2ClientReader

type Oauth2ClientReader interface {
	Read(token string) (auth.Oauth2Client, error)
}

Oauth2ClientReader defines the interface for retrieving an OAuth2 client

type Receiver

type Receiver func() (*loggregator_v2.EnvelopeBatch, error)

Receiver defines a function for receiving batch envelopes

Jump to

Keyboard shortcuts

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