mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-07-02 17:58:46 +00:00
Export instance context
This commit is contained in:
@@ -25,3 +25,10 @@ func MustFromContext(ctx context.Context) *Instance {
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
func WithContext(ctx context.Context, v *Instance) context.Context {
|
||||
if FromContext(ctx) != v {
|
||||
ctx = context.WithValue(ctx, xrayKey, v)
|
||||
}
|
||||
return ctx
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user