实现自动SYN Flood防护

This commit is contained in:
GoEdgeLab
2022-01-10 19:54:10 +08:00
parent 1e718021db
commit fc4e02c82d
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
}