shadowsocks_test.go 831 B

123456789101112131415161718192021222324252627282930313233343536
  1. package conf_test
  2. import (
  3. "testing"
  4. "github.com/xtls/xray-core/common/net"
  5. "github.com/xtls/xray-core/common/protocol"
  6. "github.com/xtls/xray-core/common/serial"
  7. . "github.com/xtls/xray-core/infra/conf"
  8. "github.com/xtls/xray-core/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-128-gcm",
  18. "password": "xray-password"
  19. }`,
  20. Parser: loadJSON(creator),
  21. Output: &shadowsocks.ServerConfig{
  22. Users: []*protocol.User{{
  23. Account: serial.ToTypedMessage(&shadowsocks.Account{
  24. CipherType: shadowsocks.CipherType_AES_128_GCM,
  25. Password: "xray-password",
  26. }),
  27. }},
  28. Network: []net.Network{net.Network_TCP},
  29. },
  30. },
  31. })
  32. }