1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-07-26 11:44:22 -04:00

16 lines
370 B
Go
Raw Normal View History

2021-09-05 15:36:57 +01:00
package envctx
import "context"
const (
2022-02-06 21:53:15 +00:00
environmentKey string = "v2.environment"
2021-09-05 15:36:57 +01:00
)
func ContextWithEnvironment(ctx context.Context, environment interface{}) context.Context {
2022-06-28 20:26:01 +08:00
return context.WithValue(ctx, environmentKey, environment) //nolint: revive,staticcheck
2021-09-05 15:36:57 +01:00
}
func EnvironmentFromContext(ctx context.Context) interface{} {
return ctx.Value(environmentKey)
2021-09-05 15:36:57 +01:00
}