From 1368e926057a0d1d2efe4322926aad1af6ea8aee Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Mon, 1 Mar 2021 15:39:52 +0000 Subject: [PATCH] Imaginary Security Lever: zero: turn off all security on payload data --- infra/conf/vmess.go | 2 ++ proxy/vmess/outbound/outbound.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/infra/conf/vmess.go b/infra/conf/vmess.go index 8e6a88662..4c330d0d5 100644 --- a/infra/conf/vmess.go +++ b/infra/conf/vmess.go @@ -31,6 +31,8 @@ func (a *VMessAccount) Build() *vmess.Account { st = protocol.SecurityType_AUTO case "none": st = protocol.SecurityType_NONE + case "zero": + st = protocol.SecurityType_ZERO default: st = protocol.SecurityType_AUTO } diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 7b48df637..c41f767ce 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -110,6 +110,12 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte request.Option.Set(protocol.RequestOptionGlobalPadding) } + if request.Security == protocol.SecurityType_ZERO { + request.Security = protocol.SecurityType_NONE + request.Option.Clear(protocol.RequestOptionChunkStream) + request.Option.Clear(protocol.RequestOptionChunkMasking) + } + input := link.Reader output := link.Writer