type Peer … // String ensures the Peer types implements the Stringer interface in order to // allow to print a context with a peerKey value effectively. func (p *Peer) String() string { … } type peerKey … // NewContext creates a new context with peer information attached. func NewContext(ctx context.Context, p *Peer) context.Context { … } // FromContext returns the peer information in ctx if it exists. func FromContext(ctx context.Context) (p *Peer, ok bool) { … }