context

package
v0.72.10 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 4 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")
	ErrChainIDMissing     = errors.New("no or invalid chain id set on context")
	ErrTxHashMissing      = errors.New("no or invalid transaction hash set on context")
)

Functions

func BlockHeightFromContext

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

func ChainIDFromContext

func ChainIDFromContext(ctx context.Context) (string, 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 TxHashFromContext

func TxHashFromContext(ctx context.Context) (string, error)

func WithBlockHeight

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

func WithChainID

func WithChainID(ctx context.Context, chainID string) 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.

func WithTxHash

func WithTxHash(ctx context.Context, txHash string) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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