mtproto_test.go 856 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package conf_test
  2. import (
  3. "testing"
  4. "github.com/xtls/xray-core/common/protocol"
  5. "github.com/xtls/xray-core/common/serial"
  6. . "github.com/xtls/xray-core/infra/conf"
  7. "github.com/xtls/xray-core/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": "[email protected]",
  18. "level": 1,
  19. "secret": "b0cbcef5a486d9636472ac27f8e11a9d"
  20. }]
  21. }`,
  22. Parser: loadJSON(creator),
  23. Output: &mtproto.ServerConfig{
  24. User: []*protocol.User{
  25. {
  26. Email: "[email protected]",
  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. }