mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 07:26:24 -05:00
test case for shadowsocks as inbound detour
This commit is contained in:
parent
8daa427daf
commit
f7c6ecde90
@ -7,6 +7,17 @@
|
|||||||
"password": "v2ray-password"
|
"password": "v2ray-password"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"inboundDetour": [
|
||||||
|
{
|
||||||
|
"protocol": "shadowsocks",
|
||||||
|
"port": 50055,
|
||||||
|
"settings": {
|
||||||
|
"method": "aes-128-cfb",
|
||||||
|
"password": "v2ray-another",
|
||||||
|
"udp": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
"outbound": {
|
"outbound": {
|
||||||
"protocol": "freedom",
|
"protocol": "freedom",
|
||||||
"settings": {}
|
"settings": {}
|
||||||
|
@ -50,5 +50,24 @@ func TestShadowsocksTCP(t *testing.T) {
|
|||||||
assert.StringLiteral("Processed: " + payload).Equals(string(response[:nBytes]))
|
assert.StringLiteral("Processed: " + payload).Equals(string(response[:nBytes]))
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
|
||||||
|
cipher, err = ssclient.NewCipher("aes-128-cfb", "v2ray-another")
|
||||||
|
assert.Error(err).IsNil()
|
||||||
|
|
||||||
|
conn, err = ssclient.DialWithRawAddr(rawAddr, "127.0.0.1:50055", cipher)
|
||||||
|
assert.Error(err).IsNil()
|
||||||
|
|
||||||
|
payload = "shadowsocks request 2."
|
||||||
|
nBytes, err = conn.Write([]byte(payload))
|
||||||
|
assert.Error(err).IsNil()
|
||||||
|
assert.Int(nBytes).Equals(len(payload))
|
||||||
|
|
||||||
|
conn.Conn.(*net.TCPConn).CloseWrite()
|
||||||
|
|
||||||
|
response = make([]byte, 1024)
|
||||||
|
nBytes, err = conn.Read(response)
|
||||||
|
assert.Error(err).IsNil()
|
||||||
|
assert.StringLiteral("Processed: " + payload).Equals(string(response[:nBytes]))
|
||||||
|
conn.Close()
|
||||||
|
|
||||||
CloseAllServers()
|
CloseAllServers()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user