MCPcopy
hub / github.com/grpc/grpc-go / FromContext

Function FromContext

peer/peer.go:80–83  ·  view source on GitHub ↗

FromContext returns the peer information in ctx if it exists.

(ctx context.Context)

Source from the content-addressed store, hash-verified

78
79// FromContext returns the peer information in ctx if it exists.
80func FromContext(ctx context.Context) (p *Peer, ok bool) {
81 p, ok = ctx.Value(peerKey{}).(*Peer)
82 return
83}

Callers 15

processUnaryRPCMethod · 0.92
processStreamingRPCMethod · 0.92
HeaderMethod · 0.92
finishMethod · 0.92
afterMethod · 0.92
AuthInfoFromContextFunction · 0.92
TestLeastRequestE2EMethod · 0.92
UnaryCallMethod · 0.92
HandleRPCMethod · 0.92
testLocalCredsE2ESucceedFunction · 0.92

Calls 1

ValueMethod · 0.45

Tested by 8

TestLeastRequestE2EMethod · 0.74
UnaryCallMethod · 0.74
HandleRPCMethod · 0.74
testLocalCredsE2ESucceedFunction · 0.74
TestInsecureCredsMethod · 0.74
TestPeerStringerFunction · 0.68