sing-box/test/shadowsocks_legacy_test.go

56 lines
1.3 KiB
Go
Raw Normal View History

2023-05-09 09:14:49 +00:00
package main
import (
"net/netip"
"testing"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/option"
"github.com/sagernet/sing-shadowsocks2/shadowstream"
2024-11-07 13:44:04 +00:00
"github.com/sagernet/sing/common"
2023-05-09 09:14:49 +00:00
F "github.com/sagernet/sing/common/format"
2024-11-07 13:44:04 +00:00
"github.com/sagernet/sing/common/json/badoption"
2023-05-09 09:14:49 +00:00
)
func TestShadowsocksLegacy(t *testing.T) {
testShadowsocksLegacy(t, shadowstream.MethodList[0])
}
func testShadowsocksLegacy(t *testing.T, method string) {
startDockerContainer(t, DockerOptions{
Image: ImageShadowsocksLegacy,
Ports: []uint16{serverPort},
Env: []string{
"SS_MODULE=ss-server",
F.ToString("SS_CONFIG=-s 0.0.0.0 -u -p 10000 -m ", method, " -k FzcLbKs2dY9mhL"),
},
})
startInstance(t, option.Options{
2024-11-17 08:59:25 +00:00
Inbounds: []option.Inbound{
2023-05-09 09:14:49 +00:00
{
Type: C.TypeMixed,
2024-11-17 08:59:25 +00:00
Options: &option.HTTPMixedInboundOptions{
2023-05-09 09:14:49 +00:00
ListenOptions: option.ListenOptions{
2024-11-07 13:44:04 +00:00
Listen: common.Ptr(badoption.Addr(netip.IPv4Unspecified())),
2023-05-09 09:14:49 +00:00
ListenPort: clientPort,
},
},
},
},
2024-11-17 08:59:25 +00:00
Outbounds: []option.Outbound{
2023-05-09 09:14:49 +00:00
{
Type: C.TypeShadowsocks,
2024-11-17 08:59:25 +00:00
Options: &option.ShadowsocksOutboundOptions{
2023-05-09 09:14:49 +00:00
ServerOptions: option.ServerOptions{
Server: "127.0.0.1",
ServerPort: serverPort,
},
Method: method,
Password: "FzcLbKs2dY9mhL",
},
},
},
})
testSuitSimple(t, clientPort, testPort)
}