Browse Source

Check replay only for AEAD connection

Shelikhoo 5 years ago
parent
commit
9fc37646b6
1 changed files with 5 additions and 3 deletions
  1. 5 3
      proxy/vmess/aead/authid.go

+ 5 - 3
proxy/vmess/aead/authid.go

@@ -89,15 +89,17 @@ func (a *AuthIDDecoderHolder) RemoveUser(key [16]byte) {
 }
 
 func (a *AuthIDDecoderHolder) Match(AuthID [16]byte) (interface{}, error) {
-	if !a.apw.Check(AuthID[:]) {
-		return nil, ErrReplay
-	}
 	for _, v := range a.aidhi {
 
 		t, z, r, d := v.dec.Decode(AuthID)
 		if z != crc32.ChecksumIEEE(d[:12]) {
 			continue
 		}
+
+		if !a.apw.Check(AuthID[:]) {
+			return nil, ErrReplay
+		}
+
 		if math.Abs(float64(t-time.Now().Unix())) > 120 {
 			continue
 		}