shadowsocks_test.go 853 B

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