callinfo

package
v0.0.0-...-5f7613f Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2015 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package callinfo stores custom values into the Context (related to the RPC source)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GRPCCallInfo

func GRPCCallInfo(ctx context.Context) context.Context

GRPCCallInfo returns an augmented context with a CallInfo structure, only for gRPC contexts.

func HTMLFromContext

func HTMLFromContext(ctx context.Context) template.HTML

HTMLFromContext returns that value of HTML() from the context, or "" if we're not able to recover one

func NewContext

func NewContext(ctx context.Context, ci CallInfo) context.Context

NewContext adds the provided CallInfo to the context

func RPCWrapCallInfo

func RPCWrapCallInfo(ctx context.Context) context.Context

RPCWrapCallInfo takes a context generated by rpcwrap, and returns one that has CallInfo filled in.

Types

type CallInfo

type CallInfo interface {
	// RemoteAddr is the remote address information for this rpc call.
	RemoteAddr() string

	// Username is associated with this rpc call, if any.
	Username() string

	// Text is a text version of this connection, as specifically as possible.
	Text() string

	// HTML represents this rpc call connection in a web-friendly way.
	HTML() template.HTML
}

CallInfo is the extra data stored in the Context

func FromContext

func FromContext(ctx context.Context) (CallInfo, bool)

FromContext returns the CallInfo value stored in ctx, if any.

Jump to

Keyboard shortcuts

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