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

     1  package conf_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/v2fly/v2ray-core/v4/common/net"
     7  	"github.com/v2fly/v2ray-core/v4/common/protocol"
     8  	"github.com/v2fly/v2ray-core/v4/common/serial"
     9  	. "github.com/v2fly/v2ray-core/v4/infra/conf"
    10  	"github.com/v2fly/v2ray-core/v4/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-256-GCM",
    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_256_GCM,
    29  						Password:   "v2ray-password",
    30  					}),
    31  				},
    32  				Network: []net.Network{net.Network_TCP},
    33  			},
    34  		},
    35  	})
    36  }