callinfo

package
v2.0.0-rc.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2016 License: BSD-3-Clause Imports: 4 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

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