Feature: support vmess 'zero' security (#2513)

This commit is contained in:
bobo liu
2023-01-30 14:14:42 +08:00
committed by GitHub
parent 58732ee8b1
commit 81b1e9f931
4 changed files with 110 additions and 9 deletions

View File

@ -18,6 +18,8 @@ func TestClash_Vmess(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -49,6 +51,8 @@ func TestClash_VmessTLS(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -86,6 +90,8 @@ func TestClash_VmessHTTP2(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -128,6 +134,8 @@ func TestClash_VmessHTTP(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -178,6 +186,8 @@ func TestClash_VmessWebsocket(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -211,6 +221,8 @@ func TestClash_VmessWebsocketTLS(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -221,7 +233,7 @@ func TestClash_VmessWebsocketTLS(t *testing.T) {
},
}
id, err := startContainer(cfg, hostCfg, "vmess-ws")
id, err := startContainer(cfg, hostCfg, "vmess-ws-tls")
require.NoError(t, err)
t.Cleanup(func() {
cleanContainer(id)
@ -244,10 +256,51 @@ func TestClash_VmessWebsocketTLS(t *testing.T) {
testSuit(t, proxy)
}
func TestClash_VmessWebsocketTLSZero(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
Binds: []string{
fmt.Sprintf("%s:/etc/v2ray/config.json", C.Path.Resolve("vmess-ws-tls-zero.json")),
fmt.Sprintf("%s:/etc/ssl/v2ray/fullchain.pem", C.Path.Resolve("example.org.pem")),
fmt.Sprintf("%s:/etc/ssl/v2ray/privkey.pem", C.Path.Resolve("example.org-key.pem")),
},
}
id, err := startContainer(cfg, hostCfg, "vmess-ws-tls-zero")
require.NoError(t, err)
t.Cleanup(func() {
cleanContainer(id)
})
proxy, err := outbound.NewVmess(outbound.VmessOption{
Name: "vmess",
Server: localIP.String(),
Port: 10002,
UUID: "b831381d-6324-4d53-ad4f-8cda48b30811",
Cipher: "zero",
Network: "ws",
TLS: true,
SkipCertVerify: true,
UDP: true,
})
require.NoError(t, err)
time.Sleep(waitTime)
testSuit(t, proxy)
}
func TestClash_VmessGrpc(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -289,6 +342,8 @@ func TestClash_VmessWebsocket0RTT(t *testing.T) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,
@ -366,6 +421,8 @@ func Benchmark_Vmess(b *testing.B) {
cfg := &container.Config{
Image: ImageVmess,
ExposedPorts: defaultExposedPorts,
Entrypoint: []string{"/usr/bin/v2ray"},
Cmd: []string{"run", "-c", "/etc/v2ray/config.json"},
}
hostCfg := &container.HostConfig{
PortBindings: defaultPortBindings,