mtproto_test.go 872 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package conf_test
  2. import (
  3. "testing"
  4. "github.com/v2fly/v2ray-core/v4/common/protocol"
  5. "github.com/v2fly/v2ray-core/v4/common/serial"
  6. . "github.com/v2fly/v2ray-core/v4/infra/conf"
  7. "github.com/v2fly/v2ray-core/v4/proxy/mtproto"
  8. )
  9. func TestMTProtoServerConfig(t *testing.T) {
  10. creator := func() Buildable {
  11. return new(MTProtoServerConfig)
  12. }
  13. runMultiTestCase(t, []TestCase{
  14. {
  15. Input: `{
  16. "users": [{
  17. "email": "love@v2fly.org",
  18. "level": 1,
  19. "secret": "b0cbcef5a486d9636472ac27f8e11a9d"
  20. }]
  21. }`,
  22. Parser: loadJSON(creator),
  23. Output: &mtproto.ServerConfig{
  24. User: []*protocol.User{
  25. {
  26. Email: "love@v2fly.org",
  27. Level: 1,
  28. Account: serial.ToTypedMessage(&mtproto.Account{
  29. Secret: []byte{176, 203, 206, 245, 164, 134, 217, 99, 100, 114, 172, 39, 248, 225, 26, 157},
  30. }),
  31. },
  32. },
  33. },
  34. },
  35. })
  36. }