Feature: support vmess 'zero' security (#2513)
This commit is contained in:
35
test/config/vmess-ws-tls-zero.json
Normal file
35
test/config/vmess-ws-tls-zero.json
Normal file
@ -0,0 +1,35 @@
|
||||
{
|
||||
"inbounds": [
|
||||
{
|
||||
"port": 10002,
|
||||
"listen": "0.0.0.0",
|
||||
"protocol": "vmess",
|
||||
"settings": {
|
||||
"clients": [
|
||||
{
|
||||
"id": "b831381d-6324-4d53-ad4f-8cda48b30811",
|
||||
"alterId": 0,
|
||||
"security": "zero"
|
||||
}
|
||||
]
|
||||
},
|
||||
"streamSettings": {
|
||||
"network": "ws",
|
||||
"security": "tls",
|
||||
"tlsSettings": {
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/ssl/v2ray/fullchain.pem",
|
||||
"keyFile": "/etc/ssl/v2ray/privkey.pem"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom"
|
||||
}
|
||||
]
|
||||
}
|
@ -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,
|
||||
|
Reference in New Issue
Block a user