1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-27 22:36:12 -04:00
v2fly/common/environment/envctx/env.go

18 lines
376 B
Go
Raw Normal View History

2021-09-05 10:36:57 -04:00
package envctx
import "context"
type environmentContextKey int
const (
environmentKey environmentContextKey = iota
)
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
return context.WithValue(ctx, environmentKey, environment)
}
func EnvironmentFromContext(ctx context.Context) interface{} {
return ctx.Value(environmentKey)
2021-09-05 10:36:57 -04:00
}