mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-11-17 22:13:08 -08:00
massive refactoring for interoperability
This commit is contained in:
66 files changed
+1515
-1200
No files matched your search
+17
@@ -0,0 +1,17 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type key int
|
||||
|
||||
const v2rayKey key = 1
|
||||
|
||||
// FromContext returns a 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(v2rayKey).(*Instance); ok {
|
||||
return s
|
||||
}
|
||||
return nil
|
||||
}
|
||||
Reference in new issue
Block a user