优化代码

This commit is contained in:
刘祥超
2022-01-11 09:25:34 +08:00
parent 443660ac38
commit e23f4aaee2
4 changed files with 26 additions and 3 deletions

View File

@@ -135,7 +135,7 @@ func (this *ClientConn) checkSYNFlood() {
var ip = this.RawIP()
if len(ip) > 0 && !iplibrary.IsInWhiteList(ip) && (!synFloodConfig.IgnoreLocal || !utils.IsLocalIP(ip)) {
var timestamp = (utils.UnixTime()/60)*60 + 60
var timestamp = utils.NextMinuteUnixTime()
var result = ttlcache.SharedCache.IncreaseInt64("SYN_FLOOD:"+ip, 1, timestamp)
var minAttempts = synFloodConfig.MinAttempts
if minAttempts < 3 {