chore: tunnel recorder & slight refactor
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
18
store/context.go
Normal file
18
store/context.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package store
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type contextKey struct{}
|
||||
|
||||
var recordIDKey = contextKey{}
|
||||
|
||||
func withRecord(ctx context.Context, rec *TunnelRecord) context.Context {
|
||||
return context.WithValue(ctx, recordIDKey, rec)
|
||||
}
|
||||
|
||||
func getRecord(ctx context.Context) (*TunnelRecord, bool) {
|
||||
id, ok := ctx.Value(recordIDKey).(*TunnelRecord)
|
||||
return id, ok
|
||||
}
|
||||
Reference in New Issue
Block a user