shadowsocks_legacy_test.go 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. F "github.com/sagernet/sing/common/format"
  9. )
  10. func TestShadowsocksLegacy(t *testing.T) {
  11. testShadowsocksLegacy(t, shadowstream.MethodList[0])
  12. }
  13. func testShadowsocksLegacy(t *testing.T, method string) {
  14. startDockerContainer(t, DockerOptions{
  15. Image: ImageShadowsocksLegacy,
  16. Ports: []uint16{serverPort},
  17. Env: []string{
  18. "SS_MODULE=ss-server",
  19. F.ToString("SS_CONFIG=-s 0.0.0.0 -u -p 10000 -m ", method, " -k FzcLbKs2dY9mhL"),
  20. },
  21. })
  22. startInstance(t, option.Options{
  23. Inbounds: []option.Inbound{
  24. {
  25. Type: C.TypeMixed,
  26. MixedOptions: option.HTTPMixedInboundOptions{
  27. ListenOptions: option.ListenOptions{
  28. Listen: option.NewListenAddress(netip.IPv4Unspecified()),
  29. ListenPort: clientPort,
  30. },
  31. },
  32. },
  33. },
  34. Outbounds: []option.Outbound{
  35. {
  36. Type: C.TypeShadowsocks,
  37. ShadowsocksOptions: option.ShadowsocksOutboundOptions{
  38. ServerOptions: option.ServerOptions{
  39. Server: "127.0.0.1",
  40. ServerPort: serverPort,
  41. },
  42. Method: method,
  43. Password: "FzcLbKs2dY9mhL",
  44. },
  45. },
  46. },
  47. })
  48. testSuitSimple(t, clientPort, testPort)
  49. }