1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-22 01:57:12 -05:00

use correct function for to context

This commit is contained in:
Shelikhoo 2021-05-04 20:41:09 +01:00
parent 758290314f
commit 03b0c8efd9
No known key found for this signature in database
GPG Key ID: C4D5E79D22B25316

View File

@ -22,8 +22,8 @@ func TestInterfaces(t *testing.T) {
_ = (outbound.Manager)(new(Manager)) _ = (outbound.Manager)(new(Manager))
} }
//go:linkname mustToContextForced github.com/v2fly/v2ray-core/v4.mustToContext //go:linkname toContext github.com/v2fly/v2ray-core/v4.toContext
func mustToContextForced(ctx context.Context, v *core.Instance) context.Context func toContext(ctx context.Context, v *core.Instance) context.Context
func TestOutboundWithoutStatCounter(t *testing.T) { func TestOutboundWithoutStatCounter(t *testing.T) {
config := &core.Config{ config := &core.Config{
@ -41,7 +41,7 @@ func TestOutboundWithoutStatCounter(t *testing.T) {
v, _ := core.New(config) v, _ := core.New(config)
v.AddFeature((outbound.Manager)(new(Manager))) v.AddFeature((outbound.Manager)(new(Manager)))
ctx := mustToContextForced(context.Background(), v) ctx := toContext(context.Background(), v)
h, _ := NewHandler(ctx, &core.OutboundHandlerConfig{ h, _ := NewHandler(ctx, &core.OutboundHandlerConfig{
Tag: "tag", Tag: "tag",
ProxySettings: serial.ToTypedMessage(&freedom.Config{}), ProxySettings: serial.ToTypedMessage(&freedom.Config{}),
@ -70,7 +70,7 @@ func TestOutboundWithStatCounter(t *testing.T) {
v, _ := core.New(config) v, _ := core.New(config)
v.AddFeature((outbound.Manager)(new(Manager))) v.AddFeature((outbound.Manager)(new(Manager)))
ctx := mustToContextForced(context.Background(), v) ctx := toContext(context.Background(), v)
h, _ := NewHandler(ctx, &core.OutboundHandlerConfig{ h, _ := NewHandler(ctx, &core.OutboundHandlerConfig{
Tag: "tag", Tag: "tag",
ProxySettings: serial.ToTypedMessage(&freedom.Config{}), ProxySettings: serial.ToTypedMessage(&freedom.Config{}),