Exemplo n.º 1
0
func init() {
	RegisterRenderer(func(ctx context.Context) (info CallInfo, ok bool) {
		remoteAddr, ok := proto.RemoteAddr(ctx)
		if !ok {
			return nil, false
		}
		username, ok := proto.Username(ctx)
		if !ok {
			return nil, false
		}
		return rpcWrapInfo{remoteAddr, username}, true
	})
}
Exemplo n.º 2
0
// RPCWrapCallInfo takes a context generated by rpcwrap, and
// returns one that has CallInfo filled in.
func RPCWrapCallInfo(ctx context.Context) context.Context {
	remoteAddr, _ := proto.RemoteAddr(ctx)
	return NewContext(ctx, &rpcWrapCallInfoImpl{
		remoteAddr: remoteAddr,
	})
}