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