mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 01:57:12 -05:00
Revert "feat: export (const.)core.v2rayKey (#831)"
This reverts commit 102e3295
This commit is contained in:
parent
102e32957a
commit
e31bfe02f0
@ -9,12 +9,11 @@ import (
|
||||
// V2rayKey is the key type of Instance in Context, exported for test.
|
||||
type V2rayKey int
|
||||
|
||||
// V2rayKeyValue is the key value of Instance in Context, exported for test.
|
||||
const V2rayKeyValue V2rayKey = 1
|
||||
const v2rayKey V2rayKey = 1
|
||||
|
||||
// FromContext returns an Instance from the given context, or nil if the context doesn't contain one.
|
||||
func FromContext(ctx context.Context) *Instance {
|
||||
if s, ok := ctx.Value(V2rayKeyValue).(*Instance); ok {
|
||||
if s, ok := ctx.Value(v2rayKey).(*Instance); ok {
|
||||
return s
|
||||
}
|
||||
return nil
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
func CreateObject(v *Instance, config interface{}) (interface{}, error) {
|
||||
var ctx context.Context
|
||||
if v != nil {
|
||||
ctx = context.WithValue(v.ctx, V2rayKeyValue, v)
|
||||
ctx = context.WithValue(v.ctx, v2rayKey, v)
|
||||
}
|
||||
return common.CreateObject(ctx, config)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user