From 78d7b4f1835c0fd1c4ff5e483db5aff406f56a2c Mon Sep 17 00:00:00 2001 From: Shelikhoo Date: Sat, 6 Jun 2020 20:54:29 +0800 Subject: [PATCH] Check replay only for AEAD connection, and later --- proxy/vmess/aead/authid.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/proxy/vmess/aead/authid.go b/proxy/vmess/aead/authid.go index 1c4541a5..c357d6fc 100644 --- a/proxy/vmess/aead/authid.go +++ b/proxy/vmess/aead/authid.go @@ -96,13 +96,14 @@ func (a *AuthIDDecoderHolder) Match(AuthID [16]byte) (interface{}, error) { continue } + if math.Abs(float64(t-time.Now().Unix())) > 120 { + continue + } + if !a.apw.Check(AuthID[:]) { return nil, ErrReplay } - if math.Abs(float64(t-time.Now().Unix())) > 120 { - continue - } _ = r return v.ticket, nil