|
|
|
@ -5,7 +5,6 @@ import (
|
|
|
|
|
|
|
|
|
|
"github.com/v2ray/v2ray-core/common/alloc"
|
|
|
|
|
v2net "github.com/v2ray/v2ray-core/common/net"
|
|
|
|
|
netassert "github.com/v2ray/v2ray-core/common/net/testing/assert"
|
|
|
|
|
"github.com/v2ray/v2ray-core/proxy"
|
|
|
|
|
. "github.com/v2ray/v2ray-core/proxy/shadowsocks"
|
|
|
|
|
v2testing "github.com/v2ray/v2ray-core/testing"
|
|
|
|
@ -21,8 +20,8 @@ func TestNormalRequestParsing(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
request, err := ReadRequest(buffer, nil, false)
|
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
netassert.Address(request.Address).Equals(v2net.LocalHostIP)
|
|
|
|
|
netassert.Port(request.Port).Equals(v2net.Port(80))
|
|
|
|
|
assert.Address(request.Address).Equals(v2net.LocalHostIP)
|
|
|
|
|
assert.Port(request.Port).Equals(v2net.Port(80))
|
|
|
|
|
assert.Bool(request.OTA).IsFalse()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -85,7 +84,7 @@ func TestOTARequest(t *testing.T) {
|
|
|
|
|
[]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5}))
|
|
|
|
|
request, err := ReadRequest(buffer, auth, false)
|
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
netassert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com"))
|
|
|
|
|
assert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com"))
|
|
|
|
|
assert.Bool(request.OTA).IsTrue()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -110,8 +109,8 @@ func TestUDPRequestParsing(t *testing.T) {
|
|
|
|
|
|
|
|
|
|
request, err := ReadRequest(buffer, nil, true)
|
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
netassert.Address(request.Address).Equals(v2net.LocalHostIP)
|
|
|
|
|
netassert.Port(request.Port).Equals(v2net.Port(80))
|
|
|
|
|
assert.Address(request.Address).Equals(v2net.LocalHostIP)
|
|
|
|
|
assert.Port(request.Port).Equals(v2net.Port(80))
|
|
|
|
|
assert.Bool(request.OTA).IsFalse()
|
|
|
|
|
assert.Bytes(request.UDPPayload.Value).Equals([]byte{1, 2, 3, 4, 5, 6})
|
|
|
|
|
}
|
|
|
|
@ -130,7 +129,7 @@ func TestUDPRequestWithOTA(t *testing.T) {
|
|
|
|
|
[]byte{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5}))
|
|
|
|
|
request, err := ReadRequest(buffer, auth, true)
|
|
|
|
|
assert.Error(err).IsNil()
|
|
|
|
|
netassert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com"))
|
|
|
|
|
assert.Address(request.Address).Equals(v2net.DomainAddress("www.v2ray.com"))
|
|
|
|
|
assert.Bool(request.OTA).IsTrue()
|
|
|
|
|
assert.Bytes(request.UDPPayload.Value).Equals([]byte{
|
|
|
|
|
1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0})
|
|
|
|
|