shadowsocks_test.go 1019 B

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