mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
Remove unnecessary API
This commit is contained in:
parent
0fbd8a1fd1
commit
38f522fb72
17
context.go
17
context.go
@ -45,23 +45,6 @@ func toContext(ctx context.Context, v *Instance) context.Context {
|
|||||||
return ctx
|
return ctx
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mustToContext returns ctx from the given context, or panics if not found that.
|
|
||||||
|
|
||||||
It is unsupported to use this function to create a context that is suitable to invoke V2Ray's internal component
|
|
||||||
in third party code, you shouldn't use //go:linkname to alias of this function into your own package and
|
|
||||||
use this function in your third party code.
|
|
||||||
|
|
||||||
For third party code, usage enabled by creating a context to interact with V2Ray's internal component is unsupported,
|
|
||||||
and may break at any time.
|
|
||||||
|
|
||||||
*/
|
|
||||||
func mustToContext(ctx context.Context, v *Instance) context.Context {
|
|
||||||
if c := toContext(ctx, v); c != ctx {
|
|
||||||
panic("V is not in context.")
|
|
||||||
}
|
|
||||||
return ctx
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ToBackgroundDetachedContext create a detached context from another context
|
/* ToBackgroundDetachedContext create a detached context from another context
|
||||||
Internal API
|
Internal API
|
||||||
*/
|
*/
|
||||||
|
@ -18,17 +18,3 @@ func TestFromContextPanic(t *testing.T) {
|
|||||||
|
|
||||||
MustFromContext(context.Background())
|
MustFromContext(context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname mustToContextForced github.com/v2fly/v2ray-core/v4.mustToContext
|
|
||||||
func mustToContextForced(ctx context.Context, v *Instance) context.Context
|
|
||||||
|
|
||||||
func TestToContextPanic(t *testing.T) {
|
|
||||||
defer func() {
|
|
||||||
r := recover()
|
|
||||||
if r == nil {
|
|
||||||
t.Error("expect panic, but nil")
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
mustToContextForced(context.Background(), &Instance{})
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user