github.com/imannamdari/v2ray-core/v5@v5.0.5/infra/conf/v4/shadowsocks_test.go (about) 1 package v4_test 2 3 import ( 4 "testing" 5 6 "github.com/imannamdari/v2ray-core/v5/common/net" 7 "github.com/imannamdari/v2ray-core/v5/common/protocol" 8 "github.com/imannamdari/v2ray-core/v5/common/serial" 9 "github.com/imannamdari/v2ray-core/v5/infra/conf/cfgcommon" 10 "github.com/imannamdari/v2ray-core/v5/infra/conf/cfgcommon/testassist" 11 v4 "github.com/imannamdari/v2ray-core/v5/infra/conf/v4" 12 "github.com/imannamdari/v2ray-core/v5/proxy/shadowsocks" 13 ) 14 15 func TestShadowsocksServerConfigParsing(t *testing.T) { 16 creator := func() cfgcommon.Buildable { 17 return new(v4.ShadowsocksServerConfig) 18 } 19 20 testassist.RunMultiTestCase(t, []testassist.TestCase{ 21 { 22 Input: `{ 23 "method": "aes-256-GCM", 24 "password": "v2ray-password" 25 }`, 26 Parser: testassist.LoadJSON(creator), 27 Output: &shadowsocks.ServerConfig{ 28 User: &protocol.User{ 29 Account: serial.ToTypedMessage(&shadowsocks.Account{ 30 CipherType: shadowsocks.CipherType_AES_256_GCM, 31 Password: "v2ray-password", 32 }), 33 }, 34 Network: []net.Network{net.Network_TCP}, 35 }, 36 }, 37 }) 38 }