shadowsocks_legacy_test.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package main
  2. import (
  3. "net/netip"
  4. "testing"
  5. C "github.com/sagernet/sing-box/constant"
  6. "github.com/sagernet/sing-box/option"
  7. "github.com/sagernet/sing-shadowsocks2/shadowstream"
  8. "github.com/sagernet/sing/common"
  9. F "github.com/sagernet/sing/common/format"
  10. "github.com/sagernet/sing/common/json/badoption"
  11. )
  12. func TestShadowsocksLegacy(t *testing.T) {
  13. testShadowsocksLegacy(t, shadowstream.MethodList[0])
  14. }
  15. func testShadowsocksLegacy(t *testing.T, method string) {
  16. startDockerContainer(t, DockerOptions{
  17. Image: ImageShadowsocksLegacy,
  18. Ports: []uint16{serverPort},
  19. Env: []string{
  20. "SS_MODULE=ss-server",
  21. F.ToString("SS_CONFIG=-s 0.0.0.0 -u -p 10000 -m ", method, " -k FzcLbKs2dY9mhL"),
  22. },
  23. })
  24. startInstance(t, option.Options{
  25. Inbounds: []option.Inbound{
  26. {
  27. Type: C.TypeMixed,
  28. Options: &option.HTTPMixedInboundOptions{
  29. ListenOptions: option.ListenOptions{
  30. Listen: common.Ptr(badoption.Addr(netip.IPv4Unspecified())),
  31. ListenPort: clientPort,
  32. },
  33. },
  34. },
  35. },
  36. Outbounds: []option.Outbound{
  37. {
  38. Type: C.TypeShadowsocks,
  39. Options: &option.ShadowsocksOutboundOptions{
  40. ServerOptions: option.ServerOptions{
  41. Server: "127.0.0.1",
  42. ServerPort: serverPort,
  43. },
  44. Method: method,
  45. Password: "FzcLbKs2dY9mhL",
  46. },
  47. },
  48. },
  49. })
  50. testSuitSimple(t, clientPort, testPort)
  51. }