Documentation ¶
Index ¶
- Constants
- Variables
- func GetAuthHeader(ctx context.Context) string
- func GetForwardedFor(ctx context.Context) string
- func GetHostname(ctx context.Context) string
- func GetRemoteIP(ctx context.Context) string
- func GetRequestDataMap(ctx context.Context) map[string]string
- func GetRequestID(ctx context.Context) uuid.UUID
- func GetRequestIDFromHeader(header http.Header) string
- func GetSDKVersion(ctx context.Context) string
- func GetUserAgent(ctx context.Context) string
- func NewRequestID(ctx context.Context) context.Context
- func SetRequestData(ctx context.Context, req *http.Request, requestID uuid.UUID) context.Context
- func SetRequestIDIfNotSet(ctx context.Context, requestID uuid.UUID) context.Context
Constants ¶
const RequestIDHeader = "X-Request-Id"
RequestIDHeader is the name of the header we use to return request IDs for debugging
Variables ¶
var HeaderSDKVersion = "X-Usercloudssdk-Version"
HeaderSDKVersion is the header name for the UserClouds SDK version
Functions ¶
func GetAuthHeader ¶ added in v0.6.5
GetAuthHeader returns the Authorization Header for this particular request
func GetForwardedFor ¶ added in v0.8.5
GetForwardedFor returns the X-Forwarded-For header for this particular request
func GetHostname ¶
GetHostname returns the hostname used for this particular request
func GetRemoteIP ¶ added in v0.8.5
GetRemoteIP returns the remote IP for this particular request
func GetRequestDataMap ¶ added in v0.8.0
GetRequestDataMap returns the a map of request data for a particular request, this is useful when we want to pass unstructured data to to other systems (sentry, tracing, etc...) and we don't have a reference to the request object
func GetRequestID ¶
GetRequestID returns a per request id if one was set
func GetRequestIDFromHeader ¶
GetRequestIDFromHeader returns the request ID a response headers if present, otherwise, returns an empty string
func GetSDKVersion ¶ added in v0.8.5
GetSDKVersion returns the UserClouds SDK version (from header) for this particular request
func GetUserAgent ¶ added in v0.8.3
GetUserAgent returns the User-Agent header for this particular request
func NewRequestID ¶ added in v1.0.0
NewRequestID sets a per request id if one was not set
func SetRequestData ¶ added in v0.8.0
SetRequestData sets capture a bunch of data from the request and saves into a struct in the context
Types ¶
This section is empty.