Search and commands

↑ ↓ to select · Enter to open · Esc to close

Type to search packages.

peer

v1.6.0
github.com/ppg/grpc-go/peer

Documentation

pkg.go.dev ↗

Table of contents

↓ to select · Enter to jump· Shift+Enter for source

5 matches

Top ↑

Package peer defines various peer information associated with RPCs and corresponding utils.

Functions

NewContext

func NewContext(ctx context.Context, p *Peer) context.Context

NewContext creates a new context with peer information attached.

Types

Peer

type Peer struct {
	// Addr is the peer address.
	Addr net.Addr
	// AuthInfo is the authentication information of the transport.
	// It is nil if there is no transport security being used.
	AuthInfo credentials.AuthInfo
}

Peer contains the information of the peer for an RPC, such as the address and authentication information.

FromContext

func FromContext(ctx context.Context) (p *Peer, ok bool)

FromContext returns the peer information in ctx if it exists.

Dependency graph