package audit import "context" type Recorder interface { Record(ctx context.Context, event Event) } type discardRecorder struct{} func (discardRecorder) Record(context.Context, Event) {} var Discard Recorder = discardRecorder{} type Origin struct { Actor Actor Source Source IP string UserAgent string } type originContextKey struct{} func WithOrigin(ctx context.Context, origin Origin) context.Context { return context.WithValue(ctx, originContextKey{}, origin) } func OriginFrom(ctx context.Context) (Origin, bool) { origin, ok := ctx.Value(originContextKey{}).(Origin) return origin, ok }