1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-12 16:24:19 -04:00
v2fly/infra/conf/mtproto_test.go

41 lines
872 B
Go
Raw Normal View History

2019-02-10 13:04:11 -05:00
package conf_test
import (
"testing"
2021-02-16 15:31:50 -05:00
"github.com/v2fly/v2ray-core/v4/common/protocol"
"github.com/v2fly/v2ray-core/v4/common/serial"
. "github.com/v2fly/v2ray-core/v4/infra/conf"
"github.com/v2fly/v2ray-core/v4/proxy/mtproto"
2019-02-10 13:04:11 -05:00
)
func TestMTProtoServerConfig(t *testing.T) {
creator := func() Buildable {
return new(MTProtoServerConfig)
}
runMultiTestCase(t, []TestCase{
{
Input: `{
"users": [{
2021-02-16 15:31:50 -05:00
"email": "love@v2fly.org",
2019-02-10 13:04:11 -05:00
"level": 1,
"secret": "b0cbcef5a486d9636472ac27f8e11a9d"
}]
}`,
Parser: loadJSON(creator),
Output: &mtproto.ServerConfig{
User: []*protocol.User{
{
2021-02-16 15:31:50 -05:00
Email: "love@v2fly.org",
2019-02-10 13:04:11 -05:00
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},
}),
},
},
},
},
})
}