mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-17 18:06:15 -05:00
16 lines
370 B
Go
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)
|
|
}
|