shadowsocks_test.go 918 B

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