实现自动SYN Flood防护

This commit is contained in:
刘祥超
2022-01-10 19:54:10 +08:00
parent 488430bbef
commit 443660ac38
13 changed files with 99 additions and 19 deletions

View File

@@ -36,3 +36,8 @@ func (this *BaseClientConn) Bind(serverId int64, remoteAddr string, maxConnsPerS
return sharedClientConnLimiter.Add(this.rawConn.RemoteAddr().String(), serverId, remoteAddr, maxConnsPerServer, maxConnsPerIP)
}
// RawIP 原本IP
func (this *BaseClientConn) RawIP() string {
ip, _, _ := net.SplitHostPort(this.rawConn.RemoteAddr().String())
return ip
}