VMess inbound: Optimize replay filter (#5562)

And https://github.com/XTLS/Xray-core/pull/5562#issuecomment-3765387903
This commit is contained in:
风扇滑翔翼
2026-01-28 02:34:46 +08:00
committed by GitHub
parent 077070dbe0
commit f6a7e93923
12 changed files with 84 additions and 160 deletions
+3 -3
View File
@@ -68,12 +68,12 @@ func (aidd *AuthIDDecoder) Decode(data [16]byte) (int64, uint32, int32, []byte)
}
func NewAuthIDDecoderHolder() *AuthIDDecoderHolder {
return &AuthIDDecoderHolder{make(map[string]*AuthIDDecoderItem), antireplay.NewReplayFilter(120)}
return &AuthIDDecoderHolder{make(map[string]*AuthIDDecoderItem), antireplay.NewMapFilter[[16]byte](120)}
}
type AuthIDDecoderHolder struct {
decoders map[string]*AuthIDDecoderItem
filter *antireplay.ReplayFilter
filter *antireplay.ReplayFilter[[16]byte]
}
type AuthIDDecoderItem struct {
@@ -111,7 +111,7 @@ func (a *AuthIDDecoderHolder) Match(authID [16]byte) (interface{}, error) {
return nil, ErrInvalidTime
}
if !a.filter.Check(authID[:]) {
if !a.filter.Check(authID) {
return nil, ErrReplay
}