Class IpReputation.Connection

java.lang.Object
com.aoapps.hodgepodge.net.IpReputation.Connection
Enclosing class:
IpReputation

public static class IpReputation.Connection extends Object
  • Method Details

    • accept

      This is to be called as early as possible at connection time, ideally before SSL overhead. May only be called after IpReputation.init(java.net.InetAddress).

      Whether accepted or rejected, always adds one to "bad" score, but not past the cap. This is how the score can accumulate up to the IpReputation.MAX_BAD_SCORE value. Tracks if bad score incremented, so later stages can conditionally decrement. This protects from concurrent bursts, and allows fail-fast before SSL overhead.

      Returns:
      The action to take. When IpReputation.Connection.AcceptResult.REJECT, caller is recommended to exit/close immediately (but possibly in async task/thread).
    • abort

      public void abort()
      Connection lost before operating starting. May only be called after accept() returns IpReputation.Connection.AcceptResult.ACCEPT.

      Example usage: our monitoring simply does SSL connection then disconnects, never speaks VNC protocol.

      When aborted, remove the one from "bad" if it was incremented during accept(), (Future:: When good implemented: do not do anything to "good").

    • started

      public void started()
      Indicate the action has started so abort() may no longer be performed. May only be called after accept() returns IpReputation.Connection.AcceptResult.ACCEPT.

      Don't want abort possible after operations started, bad guy could potentially use abort and timing to determine if password was good without having their "bad" score increased.

    • fail

      public void fail()
      To be called when operations fails. After calling this, the caller should delay then exit/close. May only be called after started().

      Keeps the one "bad" score from accept() if it was not capped, otherwise attempts to increase by one up to cap.

      If the record for this address has been removed or replaced, increments the bad score on the new record (up to the cap).

    • success

      public void success()
      To be called when operation succeeds. After calling this, the caller should allow the operation to continue. May only be called after started().

      Remove the one from "bad" if it was incremented during accept().

      Decrements one further "bad" to account for successful operation. (Future:: When good implemented: do not do second decrement and instead increment "good").