mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
remove deprecate ciphers in shadowsocks (#710)
* remove deprecate ciphers in shadowsocks Co-authored-by: Kslr <kslrwang@gmail.com>
This commit is contained in:
parent
1adfc2720a
commit
00bcd40c34
7 changed files with 77 additions and 543 deletions
|
@ -18,6 +18,12 @@ func toAccount(a *Account) protocol.Account {
|
|||
return account
|
||||
}
|
||||
|
||||
func equalRequestHeader(x, y *protocol.RequestHeader) bool {
|
||||
return cmp.Equal(x, y, cmp.Comparer(func(x, y protocol.RequestHeader) bool {
|
||||
return x == y
|
||||
}))
|
||||
}
|
||||
|
||||
func TestUDPEncoding(t *testing.T) {
|
||||
request := &protocol.RequestHeader{
|
||||
Version: Version,
|
||||
|
@ -27,7 +33,7 @@ func TestUDPEncoding(t *testing.T) {
|
|||
User: &protocol.MemoryUser{
|
||||
Email: "love@example.com",
|
||||
Account: toAccount(&Account{
|
||||
Password: "shadowsocks-password",
|
||||
Password: "password",
|
||||
CipherType: CipherType_AES_128_GCM,
|
||||
}),
|
||||
},
|
||||
|
@ -47,8 +53,8 @@ func TestUDPEncoding(t *testing.T) {
|
|||
t.Error("data: ", r)
|
||||
}
|
||||
|
||||
if r := cmp.Diff(decodedRequest, request, cmp.Comparer(func(a1, a2 protocol.Account) bool { return a1.Equals(a2) })); r != "" {
|
||||
t.Error("request: ", r)
|
||||
if equalRequestHeader(decodedRequest, request) == false {
|
||||
t.Error("different request")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +73,7 @@ func TestTCPRequest(t *testing.T) {
|
|||
Email: "love@example.com",
|
||||
Account: toAccount(&Account{
|
||||
Password: "tcp-password",
|
||||
CipherType: CipherType_CHACHA20_POLY1305,
|
||||
CipherType: CipherType_AES_128_GCM,
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
@ -99,7 +105,7 @@ func TestTCPRequest(t *testing.T) {
|
|||
Email: "love@example.com",
|
||||
Account: toAccount(&Account{
|
||||
Password: "password",
|
||||
CipherType: CipherType_AES_128_GCM,
|
||||
CipherType: CipherType_CHACHA20_POLY1305,
|
||||
}),
|
||||
},
|
||||
},
|
||||
|
@ -123,8 +129,8 @@ func TestTCPRequest(t *testing.T) {
|
|||
validator.Add(request.User)
|
||||
decodedRequest, reader, err := ReadTCPSession(validator, cache)
|
||||
common.Must(err)
|
||||
if r := cmp.Diff(decodedRequest, request, cmp.Comparer(func(a1, a2 protocol.Account) bool { return a1.Equals(a2) })); r != "" {
|
||||
t.Error("request: ", r)
|
||||
if equalRequestHeader(decodedRequest, request) == false {
|
||||
t.Error("different request")
|
||||
}
|
||||
|
||||
decodedData, err := reader.ReadMultiBuffer()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue