Package com.mimecast.robin.smtp.security
Interface ConnectionStore
- All Known Implementing Classes:
LocalConnectionStore,RedisConnectionStore
public interface ConnectionStore
Abstraction for connection state storage used by
ConnectionTracker.
Implementations may store state locally (in-process) or remotely (e.g. Redis) to support single-node and clustered deployments respectively.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintgetActiveConnections(String ipAddress) Gets the current number of active connections for an IP address.intgetCommandsPerMinute(String ipAddress) Gets the number of commands executed in the last minute for an IP.intgetRecentConnectionCount(String ipAddress, int windowSeconds) Gets the number of recent connections from an IP within the specified window.intGets the total number of active connections across all IPs.voidrecordBytesTransferred(String ipAddress, long bytes) Records bytes transferred for the specified IP.voidrecordCommand(String ipAddress) Records a command execution for the specified IP.voidrecordConnection(String ipAddress) Records a new connection from the specified IP address.voidrecordDisconnection(String ipAddress) Records connection closure from the specified IP address.voidreset()Clears all tracking data.voidshutdown()Shuts down any background resources held by this store.
-
Method Details
-
recordConnection
Records a new connection from the specified IP address.- Parameters:
ipAddress- The IP address establishing the connection.
-
recordDisconnection
Records connection closure from the specified IP address.- Parameters:
ipAddress- The IP address closing the connection.
-
getActiveConnections
Gets the current number of active connections for an IP address.- Parameters:
ipAddress- The IP address to check.- Returns:
- Number of active connections.
-
getTotalActiveConnections
int getTotalActiveConnections()Gets the total number of active connections across all IPs.- Returns:
- Total active connections.
-
getRecentConnectionCount
Gets the number of recent connections from an IP within the specified window.- Parameters:
ipAddress- The IP address to check.windowSeconds- Time window in seconds.- Returns:
- Number of connections within window.
-
recordCommand
Records a command execution for the specified IP.- Parameters:
ipAddress- The IP address executing the command.
-
getCommandsPerMinute
Gets the number of commands executed in the last minute for an IP.- Parameters:
ipAddress- The IP address to check.- Returns:
- Number of commands in last minute.
-
recordBytesTransferred
Records bytes transferred for the specified IP.- Parameters:
ipAddress- The IP address.bytes- Number of bytes transferred.
-
reset
void reset()Clears all tracking data. -
shutdown
void shutdown()Shuts down any background resources held by this store.
-