shadowsocksr_test.go 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. )
  8. func TestShadowsocksR(t *testing.T) {
  9. startDockerContainer(t, DockerOptions{
  10. Image: ImageShadowsocksR,
  11. Ports: []uint16{serverPort, testPort},
  12. Bind: map[string]string{
  13. "shadowsocksr.json": "/etc/shadowsocks-r/config.json",
  14. },
  15. })
  16. startInstance(t, option.Options{
  17. Inbounds: []option.Inbound{
  18. {
  19. Type: C.TypeMixed,
  20. MixedOptions: option.HTTPMixedInboundOptions{
  21. ListenOptions: option.ListenOptions{
  22. Listen: option.ListenAddress(netip.IPv4Unspecified()),
  23. ListenPort: clientPort,
  24. },
  25. },
  26. },
  27. },
  28. Outbounds: []option.Outbound{
  29. {
  30. Type: C.TypeShadowsocksR,
  31. ShadowsocksROptions: option.ShadowsocksROutboundOptions{
  32. ServerOptions: option.ServerOptions{
  33. Server: "127.0.0.1",
  34. ServerPort: serverPort,
  35. },
  36. Method: "aes-256-cfb",
  37. Password: "password0",
  38. Obfs: "plain",
  39. Protocol: "origin",
  40. },
  41. },
  42. },
  43. })
  44. testSuit(t, clientPort, testPort)
  45. }