From 43174d6951ef57942d1d358797bcd3778bbdc237 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Mon, 14 Sep 2020 17:49:59 +0800 Subject: [PATCH] support disable vmess aead by os environ --- proxy/vmess/encoding/client.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/proxy/vmess/encoding/client.go b/proxy/vmess/encoding/client.go index 836eda5b..cdff7c8a 100644 --- a/proxy/vmess/encoding/client.go +++ b/proxy/vmess/encoding/client.go @@ -12,6 +12,7 @@ import ( "hash" "hash/fnv" "io" + "os" vmessaead "v2ray.com/core/proxy/vmess/aead" "golang.org/x/crypto/chacha20poly1305" @@ -62,6 +63,12 @@ func NewClientSession(idHash protocol.IDHash, ctx context.Context) *ClientSessio } } + if vmessAeadDisable, vmessAeadDisableFound := os.LookupEnv("V2RAY_VMESS_AEAD_DISABLED"); vmessAeadDisableFound { + if vmessAeadDisable == "true" { + session.isAEADRequest = false + } + } + copy(session.requestBodyKey[:], randomBytes[:16]) copy(session.requestBodyIV[:], randomBytes[16:32]) session.responseHeader = randomBytes[32]