peer

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

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

Go to latest
Published: Oct 4, 2020 License: Apache-2.0, BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

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

NewContext creates a new context with peer information attached.

Types

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.

func FromContext

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

FromContext returns the peer information in ctx if it exists.

Jump to

Keyboard shortcuts

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