From bf2d3890de0211d65cce1b532b7c6ee43c0e4a5d Mon Sep 17 00:00:00 2001 From: Darien Raymond Date: Mon, 30 Jul 2018 09:49:00 +0200 Subject: [PATCH] padding must be enabled when chunk masking is enabled --- proxy/vmess/outbound/outbound.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/proxy/vmess/outbound/outbound.go b/proxy/vmess/outbound/outbound.go index 65de77fa..71d973d3 100644 --- a/proxy/vmess/outbound/outbound.go +++ b/proxy/vmess/outbound/outbound.go @@ -87,10 +87,6 @@ func (v *Handler) Process(ctx context.Context, link *core.Link, dialer proxy.Dia Option: protocol.RequestOptionChunkStream, } - if enablePadding { - request.Option.Set(protocol.RequestOptionGlobalPadding) - } - rawAccount, err := request.User.GetTypedAccount() if err != nil { return newError("failed to get user account").Base(err).AtWarning() @@ -102,6 +98,10 @@ func (v *Handler) Process(ctx context.Context, link *core.Link, dialer proxy.Dia request.Option.Set(protocol.RequestOptionChunkMasking) } + if enablePadding && request.Option.Has(protocol.RequestOptionChunkMasking) { + request.Option.Set(protocol.RequestOptionGlobalPadding) + } + input := link.Reader output := link.Writer