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 }) }
// 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, }) }