request

package
v6.2.0 Latest Latest
Warning

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

Go to latest
Published: May 31, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeaderForwardedAddress is the forwarded address field in request header.
	HeaderForwardedAddress = "X-Incus-forwarded-address"

	// HeaderForwardedUsername is the forwarded username field in request header.
	HeaderForwardedUsername = "X-Incus-forwarded-username"

	// HeaderForwardedProtocol is the forwarded protocol field in request header.
	HeaderForwardedProtocol = "X-Incus-forwarded-protocol"
)

Headers.

Variables

This section is empty.

Functions

func CreateRequestor

func CreateRequestor(r *http.Request) *api.EventLifecycleRequestor

CreateRequestor extracts the lifecycle event requestor data from an http.Request context.

func ProjectParam

func ProjectParam(request *http.Request) string

ProjectParam returns the project query parameter from the given request or "default" if parameter is not set.

func QueryParam

func QueryParam(request *http.Request, key string) string

QueryParam extracts the given query parameter directly from the URL, never from an encoded body.

func SaveConnectionInContext

func SaveConnectionInContext(ctx context.Context, connection net.Conn) context.Context

SaveConnectionInContext can be set as the ConnContext field of a http.Server to set the connection in the request context for later use.

Types

type CtxKey

type CtxKey string

CtxKey is the type used for all fields stored in the request context.

const (
	// CtxAccess is the access field in request context.
	CtxAccess CtxKey = "access"

	// CtxConn is the connection field in the request context.
	CtxConn CtxKey = "conn"

	// CtxAddress is the address field in request context.
	CtxAddress CtxKey = "address"

	// CtxUsername is the username field in request context.
	CtxUsername CtxKey = "username"

	// CtxProtocol is the protocol field in request context.
	CtxProtocol CtxKey = "protocol"

	// CtxForwardedAddress is the forwarded address field in request context.
	CtxForwardedAddress CtxKey = "forwarded_address"

	// CtxForwardedUsername is the forwarded username field in request context.
	CtxForwardedUsername CtxKey = "forwarded_username"

	// CtxForwardedProtocol is the forwarded protocol field in request context.
	CtxForwardedProtocol CtxKey = "forwarded_protocol"
)

Context keys.

Jump to

Keyboard shortcuts

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