mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-22 16:41:30 +00:00
Add test for ss2022 EIH
This commit is contained in:
parent
6a2bfd26d0
commit
925214869b
|
@ -74,6 +74,23 @@ func TestShadowsocks2022(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestShadowsocks2022EIH(t *testing.T) {
|
||||||
|
for _, method16 := range []string{
|
||||||
|
"2022-blake3-aes-128-gcm",
|
||||||
|
} {
|
||||||
|
t.Run(method16, func(t *testing.T) {
|
||||||
|
testShadowsocks2022EIH(t, method16, mkBase64(t, 16))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
for _, method32 := range []string{
|
||||||
|
"2022-blake3-aes-256-gcm",
|
||||||
|
} {
|
||||||
|
t.Run(method32, func(t *testing.T) {
|
||||||
|
testShadowsocks2022EIH(t, method32, mkBase64(t, 32))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func testShadowsocksInboundWithShadowsocksRust(t *testing.T, method string, password string) {
|
func testShadowsocksInboundWithShadowsocksRust(t *testing.T, method string, password string) {
|
||||||
startDockerContainer(t, DockerOptions{
|
startDockerContainer(t, DockerOptions{
|
||||||
Image: ImageShadowsocksRustClient,
|
Image: ImageShadowsocksRustClient,
|
||||||
|
@ -252,6 +269,67 @@ func TestShadowsocksUoT(t *testing.T) {
|
||||||
testSuit(t, clientPort, testPort)
|
testSuit(t, clientPort, testPort)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func testShadowsocks2022EIH(t *testing.T, method string, password string) {
|
||||||
|
startInstance(t, option.Options{
|
||||||
|
Inbounds: []option.Inbound{
|
||||||
|
{
|
||||||
|
Type: C.TypeMixed,
|
||||||
|
Tag: "mixed-in",
|
||||||
|
MixedOptions: option.HTTPMixedInboundOptions{
|
||||||
|
ListenOptions: option.ListenOptions{
|
||||||
|
Listen: option.NewListenAddress(netip.IPv4Unspecified()),
|
||||||
|
ListenPort: clientPort,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: C.TypeShadowsocks,
|
||||||
|
ShadowsocksOptions: option.ShadowsocksInboundOptions{
|
||||||
|
ListenOptions: option.ListenOptions{
|
||||||
|
Listen: option.NewListenAddress(netip.IPv4Unspecified()),
|
||||||
|
ListenPort: serverPort,
|
||||||
|
},
|
||||||
|
Method: method,
|
||||||
|
Password: password,
|
||||||
|
Users: []option.ShadowsocksUser{
|
||||||
|
{
|
||||||
|
Password: password,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Outbounds: []option.Outbound{
|
||||||
|
{
|
||||||
|
Type: C.TypeDirect,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Type: C.TypeShadowsocks,
|
||||||
|
Tag: "ss-out",
|
||||||
|
ShadowsocksOptions: option.ShadowsocksOutboundOptions{
|
||||||
|
ServerOptions: option.ServerOptions{
|
||||||
|
Server: "127.0.0.1",
|
||||||
|
ServerPort: serverPort,
|
||||||
|
},
|
||||||
|
Method: method,
|
||||||
|
Password: password + ":" + password,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Route: &option.RouteOptions{
|
||||||
|
Rules: []option.Rule{
|
||||||
|
{
|
||||||
|
DefaultOptions: option.DefaultRule{
|
||||||
|
Inbound: []string{"mixed-in"},
|
||||||
|
Outbound: "ss-out",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
testSuit(t, clientPort, testPort)
|
||||||
|
}
|
||||||
|
|
||||||
func mkBase64(t *testing.T, length int) string {
|
func mkBase64(t *testing.T, length int) string {
|
||||||
psk := make([]byte, length)
|
psk := make([]byte, length)
|
||||||
_, err := rand.Read(psk)
|
_, err := rand.Read(psk)
|
||||||
|
|
Loading…
Reference in a new issue