Xray-core/infra/conf/mtproto_test.go

41 lines
856 B
Go
Raw Permalink Normal View History

2020-11-25 13:01:53 +02:00
package conf_test
import (
"testing"
2020-12-04 03:36:16 +02:00
"github.com/xtls/xray-core/common/protocol"
"github.com/xtls/xray-core/common/serial"
. "github.com/xtls/xray-core/infra/conf"
"github.com/xtls/xray-core/proxy/mtproto"
2020-11-25 13:01:53 +02:00
)
func TestMTProtoServerConfig(t *testing.T) {
creator := func() Buildable {
return new(MTProtoServerConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"users": [{
"email": "love@example.com",
"level": 1,
"secret": "b0cbcef5a486d9636472ac27f8e11a9d"
}]
}`,
Parser: loadJSON(creator),
Output: &mtproto.ServerConfig{
User: []*protocol.User{
{
Email: "love@example.com",
Level: 1,
Account: serial.ToTypedMessage(&mtproto.Account{
Secret: []byte{176, 203, 206, 245, 164, 134, 217, 99, 100, 114, 172, 39, 248, 225, 26, 157},
}),
},
},
},
},
})
}