github.com/Uhtred009/v2ray-core-1@v4.31.2+incompatible/infra/conf/shadowsocks_test.go (about)

     1  package conf_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"v2ray.com/core/common/net"
     7  	"v2ray.com/core/common/protocol"
     8  	"v2ray.com/core/common/serial"
     9  	. "v2ray.com/core/infra/conf"
    10  	"v2ray.com/core/proxy/shadowsocks"
    11  )
    12  
    13  func TestShadowsocksServerConfigParsing(t *testing.T) {
    14  	creator := func() Buildable {
    15  		return new(ShadowsocksServerConfig)
    16  	}
    17  
    18  	runMultiTestCase(t, []TestCase{
    19  		{
    20  			Input: `{
    21  				"method": "aes-128-cfb",
    22  				"password": "v2ray-password"
    23  			}`,
    24  			Parser: loadJSON(creator),
    25  			Output: &shadowsocks.ServerConfig{
    26  				User: &protocol.User{
    27  					Account: serial.ToTypedMessage(&shadowsocks.Account{
    28  						CipherType: shadowsocks.CipherType_AES_128_CFB,
    29  						Password:   "v2ray-password",
    30  					}),
    31  				},
    32  				Network: []net.Network{net.Network_TCP},
    33  			},
    34  		},
    35  	})
    36  }