Back to godoc.org

Package peer

v1.32.0
Latest Go to latest

The latest major version is .

Published: Sep 8, 2020 | License: Apache-2.0 | Module: google.golang.org/grpc

Overview

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

Index

func NewContext

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

NewContext creates a new context with peer information attached.

type 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.

func FromContext

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

FromContext returns the peer information in ctx if it exists.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier