feat(integration): components now play nicer with each other
This commit is contained in:
@ -298,19 +298,20 @@ export class ConnectionManager implements IConnectionManager {
|
||||
// Get client IP
|
||||
const remoteAddress = socket.remoteAddress || '0.0.0.0';
|
||||
|
||||
// Check rate limits by IP
|
||||
if (this.isIPRateLimited(remoteAddress)) {
|
||||
this.rejectConnection(socket, 'Rate limit exceeded');
|
||||
// Use UnifiedRateLimiter for connection rate limiting
|
||||
const emailServer = this.smtpServer.getEmailServer();
|
||||
const rateLimiter = emailServer.getRateLimiter();
|
||||
|
||||
// Check connection limit with UnifiedRateLimiter
|
||||
const connectionResult = rateLimiter.recordConnection(remoteAddress);
|
||||
if (!connectionResult.allowed) {
|
||||
this.rejectConnection(socket, connectionResult.reason || 'Rate limit exceeded');
|
||||
this.connectionStats.rejectedConnections++;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check per-IP connection limit
|
||||
if (this.hasReachedIPConnectionLimit(remoteAddress)) {
|
||||
this.rejectConnection(socket, 'Too many connections from this IP');
|
||||
this.connectionStats.rejectedConnections++;
|
||||
return;
|
||||
}
|
||||
// Still track IP connections locally for cleanup purposes
|
||||
this.trackIPConnection(remoteAddress);
|
||||
|
||||
// Check if maximum global connections reached
|
||||
if (this.hasReachedMaxConnections()) {
|
||||
@ -454,19 +455,20 @@ export class ConnectionManager implements IConnectionManager {
|
||||
// Get client IP
|
||||
const remoteAddress = socket.remoteAddress || '0.0.0.0';
|
||||
|
||||
// Check rate limits by IP
|
||||
if (this.isIPRateLimited(remoteAddress)) {
|
||||
this.rejectConnection(socket, 'Rate limit exceeded');
|
||||
// Use UnifiedRateLimiter for connection rate limiting
|
||||
const emailServer = this.smtpServer.getEmailServer();
|
||||
const rateLimiter = emailServer.getRateLimiter();
|
||||
|
||||
// Check connection limit with UnifiedRateLimiter
|
||||
const connectionResult = rateLimiter.recordConnection(remoteAddress);
|
||||
if (!connectionResult.allowed) {
|
||||
this.rejectConnection(socket, connectionResult.reason || 'Rate limit exceeded');
|
||||
this.connectionStats.rejectedConnections++;
|
||||
return;
|
||||
}
|
||||
|
||||
// Check per-IP connection limit
|
||||
if (this.hasReachedIPConnectionLimit(remoteAddress)) {
|
||||
this.rejectConnection(socket, 'Too many connections from this IP');
|
||||
this.connectionStats.rejectedConnections++;
|
||||
return;
|
||||
}
|
||||
// Still track IP connections locally for cleanup purposes
|
||||
this.trackIPConnection(remoteAddress);
|
||||
|
||||
// Check if maximum global connections reached
|
||||
if (this.hasReachedMaxConnections()) {
|
||||
|
Reference in New Issue
Block a user