mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 08:54:10 +00:00
v1.0.0
This commit is contained in:
parent
47d23e9972
commit
c7f7c08ead
711 changed files with 82154 additions and 2 deletions
37
proxy/vmess/encoding/commands_test.go
Normal file
37
proxy/vmess/encoding/commands_test.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package encoding_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
"github.com/xtls/xray-core/v1/common"
|
||||
"github.com/xtls/xray-core/v1/common/buf"
|
||||
"github.com/xtls/xray-core/v1/common/protocol"
|
||||
"github.com/xtls/xray-core/v1/common/uuid"
|
||||
. "github.com/xtls/xray-core/v1/proxy/vmess/encoding"
|
||||
)
|
||||
|
||||
func TestSwitchAccount(t *testing.T) {
|
||||
sa := &protocol.CommandSwitchAccount{
|
||||
Port: 1234,
|
||||
ID: uuid.New(),
|
||||
AlterIds: 1024,
|
||||
Level: 128,
|
||||
ValidMin: 16,
|
||||
}
|
||||
|
||||
buffer := buf.New()
|
||||
common.Must(MarshalCommand(sa, buffer))
|
||||
|
||||
cmd, err := UnmarshalCommand(1, buffer.BytesFrom(2))
|
||||
common.Must(err)
|
||||
|
||||
sa2, ok := cmd.(*protocol.CommandSwitchAccount)
|
||||
if !ok {
|
||||
t.Fatal("failed to convert command to CommandSwitchAccount")
|
||||
}
|
||||
if r := cmp.Diff(sa2, sa); r != "" {
|
||||
t.Error(r)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue