github.com/v2fly/v2ray-core/v5@v5.16.2-0.20240507031116-8191faa6e095/infra/conf/v4/shadowsocks_test.go (about) 1 package v4_test 2 3 import ( 4 "testing" 5 6 "github.com/v2fly/v2ray-core/v5/common/net" 7 "github.com/v2fly/v2ray-core/v5/common/protocol" 8 "github.com/v2fly/v2ray-core/v5/common/serial" 9 "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon" 10 "github.com/v2fly/v2ray-core/v5/infra/conf/cfgcommon/testassist" 11 v4 "github.com/v2fly/v2ray-core/v5/infra/conf/v4" 12 "github.com/v2fly/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 }