common

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: May 16, 2022 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientIpFromRequest added in v0.7.4

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

This section is empty.

Jump to

Keyboard shortcuts

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