middleware

package
v0.0.0-...-e48602c Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetricsRecorder

func MetricsRecorder(next http.Handler) http.Handler

MetricsRecorder is the middleware that records metrics for the request

func RequestFingerprinter

func RequestFingerprinter(next http.Handler) http.Handler

RequestFingerprinter tracks each individual request coming into the system for debugging purposes

Types

type Authenticator

type Authenticator struct {
}

Authenticator manages the authentication for requests. It is empty here but could be extended to pull in state (for example if you wanted to check user auth against a persistent store then you would keep the connection in here).

func NewAuthenticator

func NewAuthenticator() *Authenticator

NewAuthenticator creates a new authenticator struct that could be used to authenticate requests.

func (Authenticator) Authenticate

func (a Authenticator) Authenticate(next http.Handler) http.Handler

Authenticate authenticates requests for the authenticator

type RequestFingerprint

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

RequestFingerprint manages the fingerprint information for a request. This struct is passed in a context via the http.Request `WithContext` function. This means that anything downstream of the fingerpring will have access to the information within the fingerprint simply by calling the `GetRequestFingerprint(r) function.`

func GetRequestFingerprint

func GetRequestFingerprint(r *http.Request) (f *RequestFingerprint, err error)

GetRequestFingerprint gets the fingerprint of the request

func NewRequestFingerprint

func NewRequestFingerprint(r *http.Request) *RequestFingerprint

NewRequestFingerprint creates a new fingerprint for a request

func (*RequestFingerprint) GetID

func (f *RequestFingerprint) GetID() (id string)

GetID gets the id fingerprint of the request

func (*RequestFingerprint) GetSource

func (f *RequestFingerprint) GetSource() (source string)

GetSource gets the source ip for a request

func (*RequestFingerprint) GetUser

func (f *RequestFingerprint) GetUser() (user string)

GetUser gets the user of the request

func (*RequestFingerprint) SetUser

func (f *RequestFingerprint) SetUser(user string)

SetUser sets the user for a request fingerprint

Jump to

Keyboard shortcuts

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