github.com/EagleQL/Xray-core@v1.4.3/infra/conf/shadowsocks_test.go (about)

     1  package conf_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/xtls/xray-core/common/net"
     7  	"github.com/xtls/xray-core/common/protocol"
     8  	"github.com/xtls/xray-core/common/serial"
     9  	. "github.com/xtls/xray-core/infra/conf"
    10  	"github.com/xtls/xray-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-gcm",
    22  				"password": "xray-password"
    23  			}`,
    24  			Parser: loadJSON(creator),
    25  			Output: &shadowsocks.ServerConfig{
    26  				Users: []*protocol.User{{
    27  					Account: serial.ToTypedMessage(&shadowsocks.Account{
    28  						CipherType: shadowsocks.CipherType_AES_128_GCM,
    29  						Password:   "xray-password",
    30  					}),
    31  				}},
    32  				Network: []net.Network{net.Network_TCP},
    33  			},
    34  		},
    35  	})
    36  }