1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-11-17 18:06:15 -05:00
v2fly/common/environment/envctx/env.go
2022-06-28 21:36:12 +08:00

16 lines
370 B
Go

package envctx
import "context"
const (
environmentKey string = "v2.environment"
)
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
return context.WithValue(ctx, environmentKey, environment) //nolint: revive,staticcheck
}
func EnvironmentFromContext(ctx context.Context) interface{} {
return ctx.Value(environmentKey)
}