mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 18:17:52 -05:00
dce8764fd7
* Lint: replace golint with revive * Lint: fix lint
18 lines
376 B
Go
18 lines
376 B
Go
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)
|
|
}
|