contextutil

package
v0.67.1 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockHeightMissing = errors.New("no or invalid block height set on context")
)

Functions

func BlockHeightFromContext

func BlockHeightFromContext(ctx context.Context) (int64, error)

func RemoteIPAddrFromContext

func RemoteIPAddrFromContext(ctx context.Context) (string, bool)

RemoteIPAddrFromContext returns the remote IP addr value stored in ctx, if any.

func TraceIDFromContext

func TraceIDFromContext(ctx context.Context) (context.Context, string)

TraceIDFromContext get traceID from context (add one if none is set).

func WithBlockHeight

func WithBlockHeight(ctx context.Context, h int64) context.Context

func WithRemoteIPAddr

func WithRemoteIPAddr(ctx context.Context, addr string) context.Context

WithRemoteIPAddr wrap the context into a new context and embed the ip addr as a key.

func WithTraceID

func WithTraceID(ctx context.Context, tID string) context.Context

WithTraceID returns a context with a traceID value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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