github.com/imannamdari/v2ray-core/v5@v5.0.5/common/environment/envctx/env.go (about)

     1  package envctx
     2  
     3  import "context"
     4  
     5  const (
     6  	environmentKey string = "v2.environment"
     7  )
     8  
     9  func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
    10  	return context.WithValue(ctx, environmentKey, environment) //nolint: revive,staticcheck
    11  }
    12  
    13  func EnvironmentFromContext(ctx context.Context) interface{} {
    14  	return ctx.Value(environmentKey)
    15  }