V2Ray 10 năm trước cách đây
mục cha
commit
4bc91b0215
3 tập tin đã thay đổi với 27 bổ sung24 xóa
  1. 5 4
      proxy/freedom/freedom_test.go
  2. 12 11
      proxy/socks/socks_test.go
  3. 10 9
      proxy/vmess/vmess_test.go

+ 5 - 4
proxy/freedom/freedom_test.go

@@ -8,9 +8,10 @@ import (
 
 	"golang.org/x/net/proxy"
 
-	"github.com/v2ray/v2ray-core"
+	"github.com/v2ray/v2ray-core/app/point"
 	"github.com/v2ray/v2ray-core/common/alloc"
 	v2net "github.com/v2ray/v2ray-core/common/net"
+	v2proxy "github.com/v2ray/v2ray-core/proxy"
 	_ "github.com/v2ray/v2ray-core/proxy/socks"
 	"github.com/v2ray/v2ray-core/proxy/socks/config/json"
 	"github.com/v2ray/v2ray-core/testing/mocks"
@@ -42,7 +43,7 @@ func TestUDPSend(t *testing.T) {
 		DataReturned: bytes.NewBuffer(make([]byte, 0, 1024)),
 	}
 
-	core.RegisterInboundConnectionHandlerFactory("mock_ich", ich)
+	v2proxy.RegisterInboundConnectionHandlerFactory("mock_ich", ich)
 
 	pointPort := uint16(38724)
 	config := mocks.Config{
@@ -57,7 +58,7 @@ func TestUDPSend(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()
@@ -104,7 +105,7 @@ func TestSocksTcpConnect(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()

+ 12 - 11
proxy/socks/socks_test.go

@@ -8,7 +8,8 @@ import (
 
 	"golang.org/x/net/proxy"
 
-	"github.com/v2ray/v2ray-core"
+	"github.com/v2ray/v2ray-core/app/point"
+	v2proxy "github.com/v2ray/v2ray-core/proxy"
 	"github.com/v2ray/v2ray-core/proxy/socks/config/json"
 	"github.com/v2ray/v2ray-core/testing/mocks"
 	"github.com/v2ray/v2ray-core/testing/unit"
@@ -23,7 +24,7 @@ func TestSocksTcpConnect(t *testing.T) {
 		Data2Return: []byte("The data to be returned to socks server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	config := mocks.Config{
 		PortValue: port,
@@ -39,7 +40,7 @@ func TestSocksTcpConnect(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()
@@ -76,7 +77,7 @@ func TestSocksTcpConnectWithUserPass(t *testing.T) {
 		Data2Return: []byte("The data to be returned to socks server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	config := mocks.Config{
 		PortValue: port,
@@ -98,7 +99,7 @@ func TestSocksTcpConnectWithUserPass(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()
@@ -135,7 +136,7 @@ func TestSocksTcpConnectWithWrongUserPass(t *testing.T) {
 		Data2Return: []byte("The data to be returned to socks server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	config := mocks.Config{
 		PortValue: port,
@@ -157,7 +158,7 @@ func TestSocksTcpConnectWithWrongUserPass(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()
@@ -180,7 +181,7 @@ func TestSocksTcpConnectWithWrongAuthMethod(t *testing.T) {
 		Data2Return: []byte("The data to be returned to socks server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	config := mocks.Config{
 		PortValue: port,
@@ -202,7 +203,7 @@ func TestSocksTcpConnectWithWrongAuthMethod(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()
@@ -225,7 +226,7 @@ func TestSocksUdpSend(t *testing.T) {
 		Data2Return: []byte("The data to be returned to socks server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	v2proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	config := mocks.Config{
 		PortValue: port,
@@ -242,7 +243,7 @@ func TestSocksUdpSend(t *testing.T) {
 		},
 	}
 
-	point, err := core.NewPoint(&config)
+	point, err := point.NewPoint(&config)
 	assert.Error(err).IsNil()
 
 	err = point.Start()

+ 10 - 9
proxy/vmess/vmess_test.go

@@ -4,9 +4,10 @@ import (
 	"bytes"
 	"testing"
 
-	"github.com/v2ray/v2ray-core"
+	"github.com/v2ray/v2ray-core/app/point"
 	"github.com/v2ray/v2ray-core/common/alloc"
 	v2net "github.com/v2ray/v2ray-core/common/net"
+	"github.com/v2ray/v2ray-core/proxy"
 	"github.com/v2ray/v2ray-core/testing/mocks"
 	"github.com/v2ray/v2ray-core/testing/unit"
 )
@@ -22,7 +23,7 @@ func TestVMessInAndOut(t *testing.T) {
 		DataReturned: bytes.NewBuffer(make([]byte, 0, 1024)),
 	}
 
-	core.RegisterInboundConnectionHandlerFactory("mock_ich", ich)
+	proxy.RegisterInboundConnectionHandlerFactory("mock_ich", ich)
 
 	configA := mocks.Config{
 		PortValue: portA,
@@ -47,7 +48,7 @@ func TestVMessInAndOut(t *testing.T) {
 		},
 	}
 
-	pointA, err := core.NewPoint(&configA)
+	pointA, err := point.NewPoint(&configA)
 	assert.Error(err).IsNil()
 
 	err = pointA.Start()
@@ -60,7 +61,7 @@ func TestVMessInAndOut(t *testing.T) {
 		Data2Return: []byte("The data to be returned to inbound server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	configB := mocks.Config{
 		PortValue: portB,
@@ -78,7 +79,7 @@ func TestVMessInAndOut(t *testing.T) {
 		},
 	}
 
-	pointB, err := core.NewPoint(&configB)
+	pointB, err := point.NewPoint(&configB)
 	assert.Error(err).IsNil()
 
 	err = pointB.Start()
@@ -101,7 +102,7 @@ func TestVMessInAndOutUDP(t *testing.T) {
 		DataReturned: bytes.NewBuffer(make([]byte, 0, 1024)),
 	}
 
-	core.RegisterInboundConnectionHandlerFactory("mock_ich", ich)
+	proxy.RegisterInboundConnectionHandlerFactory("mock_ich", ich)
 
 	configA := mocks.Config{
 		PortValue: portA,
@@ -126,7 +127,7 @@ func TestVMessInAndOutUDP(t *testing.T) {
 		},
 	}
 
-	pointA, err := core.NewPoint(&configA)
+	pointA, err := point.NewPoint(&configA)
 	assert.Error(err).IsNil()
 
 	err = pointA.Start()
@@ -139,7 +140,7 @@ func TestVMessInAndOutUDP(t *testing.T) {
 		Data2Return: []byte("The data to be returned to inbound server."),
 	}
 
-	core.RegisterOutboundConnectionHandlerFactory("mock_och", och)
+	proxy.RegisterOutboundConnectionHandlerFactory("mock_och", och)
 
 	configB := mocks.Config{
 		PortValue: portB,
@@ -158,7 +159,7 @@ func TestVMessInAndOutUDP(t *testing.T) {
 		},
 	}
 
-	pointB, err := core.NewPoint(&configB)
+	pointB, err := point.NewPoint(&configB)
 	assert.Error(err).IsNil()
 
 	err = pointB.Start()