Interface AntiSpamService

  • All Known Implementing Classes:
    AntiSpamServiceImpl

    public interface AntiSpamService
    Anti-spam service Helps to prevent simple DDOS attacks
    Author:
    Ruslan Nazirov
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean isBlocked​(java.lang.String ip, java.lang.String operation, long unblockInterval, long blockInterval)
      Check if user blocked and can't execute certain operation
      boolean isBlocked​(java.lang.String ip, java.lang.String operation, long unblockInterval, long blockInterval, java.lang.String data)
      Check if user blocked and can't execute certain operation
    • Method Detail

      • isBlocked

        boolean isBlocked​(java.lang.String ip,
                          java.lang.String operation,
                          long unblockInterval,
                          long blockInterval)
        Check if user blocked and can't execute certain operation
        Parameters:
        ip - IP address of a user
        operation - operation to execute
        unblockInterval - how much time (value = 1000 means 1 second) should pass to unblock user so he can call operations on integration server.
        blockInterval - how much time (value = 1000 means 1 second) should pass between operation calls to process operation request as normal, otherwise activate anti-spam protection.
        Returns:
        true if user is blocked and can't execute this operation
      • isBlocked

        boolean isBlocked​(java.lang.String ip,
                          java.lang.String operation,
                          long unblockInterval,
                          long blockInterval,
                          java.lang.String data)
        Check if user blocked and can't execute certain operation
        Parameters:
        ip - IP address of a user
        operation - operation to execute
        unblockInterval - how much time (value = 1000 means 1 second) should pass to unblock user so he can call operations on integration server.
        blockInterval - how much time (value = 1000 means 1 second) should pass between operation calls to process operation request as normal, otherwise activate anti-spam protection.
        data - if operation have specific data and each request has it, check for previous call data equality
        Returns:
        true if user is blocked and can't execute this operation