common

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReverseGrpcConnectionAlpnValue = "the-downstream-dialer-plays-an-uno-reverse-card"
	DataPlaneProxyAlpnValue        = "i-herd-you-like-proxies-so-i-put-a-proxy-in-your-proxy"
	ManagedWorkerTag               = "boundary.cloud.hashicorp.com:managed"
)

Variables

This section is empty.

Functions

func ClientIpFromRequest

func ClientIpFromRequest(ctx context.Context, listenerCfg *listenerutil.ListenerConfig, r *http.Request) (string, error)

ClientIpFromRequest will determine the client IP of the http request

func GeneratedTraceId

func GeneratedTraceId(ctx context.Context) string

GeneratedTraceId returns a boundary generated TraceId or "" if an error occurs when generating the id.

func WrapWithEventsHandler

func WrapWithEventsHandler(h http.Handler, e *event.Eventer, kms *kms.Kms, listenerCfg *listenerutil.ListenerConfig) (http.Handler, error)

WrapWithEventsHandler will wrap the provided http.Handler with a handler that adds an Eventer to the request context and starts/flushes gated events of type: observation and audit

func WrapWithOptionals

func WrapWithOptionals(ctx context.Context, with *writerWrapper, wrap http.ResponseWriter) (http.ResponseWriter, error)

WrapWithOptionals will test the wrap ResponseWriter and test it for various optional interfaces: http.Flusher, http.Pusher and http.Hijacker. It return an http.ResponseWriter that satisfies those optional interfaces.

See: https://medium.com/@cep21/interface-wrapping-method-erasure-c523b3549912

Types

type WorkerList added in v0.12.0

type WorkerList []*server.Worker

WorkerList is a helper type to make the selection of workers clearer and more declarative.

func (WorkerList) Addresses added in v0.12.0

func (w WorkerList) Addresses() []string

addresses converts the slice of workers to a slice of their addresses

func (WorkerList) Filtered added in v0.12.0

func (w WorkerList) Filtered(eval *bexpr.Evaluator) (WorkerList, error)

filtered returns a new workerList where all elements contained in it are the ones which from the original workerList that pass the evaluator's evaluation.

func (WorkerList) PublicIds added in v0.12.0

func (w WorkerList) PublicIds() []string

PublicIds converts the slice of workers to a slice of public ids of those workers.

func (WorkerList) SupportsFeature added in v0.12.0

func (w WorkerList) SupportsFeature(f version.Feature) WorkerList

SupportsFeature returns a new WorkerList composed of all workers in this WorkerList which supports the provided feature.

func (WorkerList) WorkerInfos added in v0.12.0

func (w WorkerList) WorkerInfos() []*pb.WorkerInfo

workerInfos converts the slice of workers to a slice of their workerInfo protos

Jump to

Keyboard shortcuts

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