From 84a05e7cd9b615f541d7316eb1d5cb8fd63445f9 Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Thu, 5 Apr 2018 21:57:35 +0200 Subject: [PATCH] remove shadowsocks conformance test --- .gitmodules | 3 - testing/scenarios/shadowsocks_test.go | 245 ------------------ vendor/github.com/shadowsocks/go-shadowsocks2 | 1 - 3 files changed, 249 deletions(-) delete mode 160000 vendor/github.com/shadowsocks/go-shadowsocks2 diff --git a/.gitmodules b/.gitmodules index 02e8083b..48543042 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,6 @@ [submodule "vendor/h12.me/socks"] path = vendor/h12.me/socks url = https://github.com/h12w/socks -[submodule "vendor/github.com/shadowsocks/go-shadowsocks2"] - path = vendor/github.com/shadowsocks/go-shadowsocks2 - url = https://github.com/shadowsocks/go-shadowsocks2 [submodule "vendor/github.com/Yawning/chacha20"] path = vendor/github.com/Yawning/chacha20 url = https://github.com/Yawning/chacha20 diff --git a/testing/scenarios/shadowsocks_test.go b/testing/scenarios/shadowsocks_test.go index 0db921b7..6ade4641 100644 --- a/testing/scenarios/shadowsocks_test.go +++ b/testing/scenarios/shadowsocks_test.go @@ -2,7 +2,6 @@ package scenarios import ( "crypto/rand" - "fmt" "sync" "testing" "time" @@ -10,7 +9,6 @@ import ( "v2ray.com/core" "v2ray.com/core/app/log" "v2ray.com/core/app/proxyman" - "v2ray.com/core/common/buf" clog "v2ray.com/core/common/log" "v2ray.com/core/common/net" "v2ray.com/core/common/protocol" @@ -21,8 +19,6 @@ import ( "v2ray.com/core/testing/servers/tcp" "v2ray.com/core/testing/servers/udp" . "v2ray.com/ext/assert" - - ss "github.com/shadowsocks/go-shadowsocks2/core" ) func TestShadowsocksAES256TCP(t *testing.T) { @@ -741,244 +737,3 @@ func TestShadowsocksAES128GCMUDPMux(t *testing.T) { CloseAllServers(servers) } - -func TestShadowsocksAES256GCMConformance(t *testing.T) { - assert := With(t) - - tcpServer := tcp.Server{ - MsgProcessor: xor, - } - dest, err := tcpServer.Start() - assert(err, IsNil) - defer tcpServer.Close() - - account := serial.ToTypedMessage(&shadowsocks.Account{ - Password: "ss-password", - CipherType: shadowsocks.CipherType_AES_256_GCM, - }) - - serverPort := tcp.PickPort() - serverConfig := &core.Config{ - App: []*serial.TypedMessage{ - serial.ToTypedMessage(&log.Config{ - ErrorLogLevel: clog.Severity_Debug, - ErrorLogType: log.LogType_Console, - }), - }, - Inbound: []*core.InboundHandlerConfig{ - { - ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ - PortRange: net.SinglePortRange(serverPort), - Listen: net.NewIPOrDomain(net.LocalHostIP), - }), - ProxySettings: serial.ToTypedMessage(&shadowsocks.ServerConfig{ - User: &protocol.User{ - Account: account, - Level: 1, - }, - Network: []net.Network{net.Network_TCP}, - }), - }, - }, - Outbound: []*core.OutboundHandlerConfig{ - { - ProxySettings: serial.ToTypedMessage(&freedom.Config{}), - }, - }, - } - - servers, err := InitializeServerConfigs(serverConfig) - assert(err, IsNil) - - var wg sync.WaitGroup - wg.Add(10) - for i := 0; i < 10; i++ { - go func() { - cipher, err := ss.PickCipher("AES-256-GCM", nil, "ss-password") - assert(err, IsNil) - conn, err := ss.Dial("tcp", fmt.Sprintf(":%d", serverPort), cipher) - assert(err, IsNil) - _, err = conn.Write([]byte{1, 127, 0, 0, 1}) - assert(err, IsNil) - _, err = conn.Write(serial.Uint16ToBytes(dest.Port.Value(), nil)) - assert(err, IsNil) - - payload := make([]byte, 10240*1024) - rand.Read(payload) - - nBytes, err := conn.Write([]byte(payload)) - assert(err, IsNil) - assert(nBytes, Equals, len(payload)) - - response := readFrom(conn, time.Second*30, 10240*1024) - assert(response, Equals, xor([]byte(payload))) - assert(conn.Close(), IsNil) - wg.Done() - }() - } - wg.Wait() - - CloseAllServers(servers) -} - -func TestShadowsocksChacha20Poly1305UDPConformance(t *testing.T) { - assert := With(t) - - udpServer := udp.Server{ - MsgProcessor: xor, - } - dest, err := udpServer.Start() - assert(err, IsNil) - defer udpServer.Close() - - account := serial.ToTypedMessage(&shadowsocks.Account{ - Password: "ss-password", - CipherType: shadowsocks.CipherType_CHACHA20_POLY1305, - }) - - serverPort := tcp.PickPort() - serverConfig := &core.Config{ - App: []*serial.TypedMessage{ - serial.ToTypedMessage(&log.Config{ - ErrorLogLevel: clog.Severity_Debug, - ErrorLogType: log.LogType_Console, - }), - }, - Inbound: []*core.InboundHandlerConfig{ - { - ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ - PortRange: net.SinglePortRange(serverPort), - Listen: net.NewIPOrDomain(net.LocalHostIP), - }), - ProxySettings: serial.ToTypedMessage(&shadowsocks.ServerConfig{ - User: &protocol.User{ - Account: account, - Level: 1, - }, - Network: []net.Network{net.Network_UDP}, - }), - }, - }, - Outbound: []*core.OutboundHandlerConfig{ - { - ProxySettings: serial.ToTypedMessage(&freedom.Config{}), - }, - }, - } - - servers, err := InitializeServerConfigs(serverConfig) - assert(err, IsNil) - - cipher, err := ss.PickCipher("CHACHA20-IETF-POLY1305", nil, "ss-password") - assert(err, IsNil) - conn, err := ss.ListenPacket("udp", ":0", cipher) - assert(err, IsNil) - - for i := 0; i < 100; i++ { - - payload := buf.New() - payload.AppendBytes(1, 127, 0, 0, 1) - payload.AppendSupplier(serial.WriteUint16(dest.Port.Value())) - - payload.AppendSupplier(buf.ReadFullFrom(rand.Reader, 10)) - - nBytes, err := conn.WriteTo(payload.Bytes(), &net.UDPAddr{ - IP: []byte{127, 0, 0, 1}, - Port: int(serverPort), - }) - assert(err, IsNil) - assert(int32(nBytes), Equals, payload.Len()) - - conn.SetReadDeadline(time.Now().Add(time.Second * 10)) - response := make([]byte, 10240) - nBytes, _, err = conn.ReadFrom(response) - assert(err, IsNil) - assert(response[:7], Equals, payload.BytesTo(7)) - assert(response[7:nBytes], Equals, xor(payload.BytesFrom(7))) - - } - - assert(conn.Close(), IsNil) - - CloseAllServers(servers) -} - -func TestShadowsocksChacha20Conformance(t *testing.T) { - assert := With(t) - - tcpServer := tcp.Server{ - MsgProcessor: xor, - } - dest, err := tcpServer.Start() - assert(err, IsNil) - defer tcpServer.Close() - - account := serial.ToTypedMessage(&shadowsocks.Account{ - Password: "ss-password", - CipherType: shadowsocks.CipherType_CHACHA20_IETF, - Ota: shadowsocks.Account_Disabled, - }) - - serverPort := tcp.PickPort() - serverConfig := &core.Config{ - App: []*serial.TypedMessage{ - serial.ToTypedMessage(&log.Config{ - ErrorLogLevel: clog.Severity_Debug, - ErrorLogType: log.LogType_Console, - }), - }, - Inbound: []*core.InboundHandlerConfig{ - { - ReceiverSettings: serial.ToTypedMessage(&proxyman.ReceiverConfig{ - PortRange: net.SinglePortRange(serverPort), - Listen: net.NewIPOrDomain(net.LocalHostIP), - }), - ProxySettings: serial.ToTypedMessage(&shadowsocks.ServerConfig{ - User: &protocol.User{ - Account: account, - Level: 1, - }, - Network: []net.Network{net.Network_TCP}, - }), - }, - }, - Outbound: []*core.OutboundHandlerConfig{ - { - ProxySettings: serial.ToTypedMessage(&freedom.Config{}), - }, - }, - } - - servers, err := InitializeServerConfigs(serverConfig) - assert(err, IsNil) - - var wg sync.WaitGroup - wg.Add(10) - for i := 0; i < 10; i++ { - go func() { - cipher, err := ss.PickCipher("CHACHA20-IETF", nil, "ss-password") - assert(err, IsNil) - conn, err := ss.Dial("tcp", fmt.Sprintf(":%d", serverPort), cipher) - assert(err, IsNil) - _, err = conn.Write([]byte{1, 127, 0, 0, 1}) - assert(err, IsNil) - _, err = conn.Write(serial.Uint16ToBytes(dest.Port.Value(), nil)) - assert(err, IsNil) - - payload := make([]byte, 10240*1024) - rand.Read(payload) - - nBytes, err := conn.Write([]byte(payload)) - assert(err, IsNil) - assert(nBytes, Equals, len(payload)) - - response := readFrom(conn, time.Second*30, 10240*1024) - assert(response, Equals, xor([]byte(payload))) - assert(conn.Close(), IsNil) - wg.Done() - }() - } - wg.Wait() - - CloseAllServers(servers) -} diff --git a/vendor/github.com/shadowsocks/go-shadowsocks2 b/vendor/github.com/shadowsocks/go-shadowsocks2 deleted file mode 160000 index 87b55c90..00000000 --- a/vendor/github.com/shadowsocks/go-shadowsocks2 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 87b55c90ac57968b4979adaef9a51c98582f76a9