github.com/v2fly/v2ray-core/v4@v4.45.2/infra/conf/mtproto_test.go (about)

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