net.i2p.i2ptunnel.access

## Class AccessFilter

- java.lang.Object
- - net.i2p.i2ptunnel.access.AccessFilter

- All Implemented Interfaces:
    IncomingConnectionFilter, StatefulConnectionFilter

      class AccessFilter
      extends Object
      implements StatefulConnectionFilter

  Incoming connection filter configurable through access list rules.

  Tracks known destinations (defined in access lists) and unknown destinations (recently attempted connections). Reloads access lists from disk when modified to allow user edits. Writes recorder data to disk at intervals when new threshold breaches occur.

- - ### Field Summary

    - ### Fields inherited from interface net.i2p.client.streaming.IncomingConnectionFilter

      `ALLOW, DENY`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AccessFilter(I2PAppContext context, FilterDefinition definition)` Create a new access filter.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `allowDestination(Destination d)` Determines if a connection to the given destination should be allowed.
    `void` | `start()` Starts the filter's background tasks.
    `void` | `stop()` Stops the filter's background tasks.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AccessFilter

          AccessFilter(I2PAppContext context,
                       FilterDefinition definition)
                throws IOException

      Create a new access filter.
      Parameters:
        `context` - the context, used for scheduling and timer purposes
        `definition` - definition of this filter
      Throws:
        `IOException` - if an I/O error occurs

  - ### Method Detail

    - #### allowDestination

          public boolean allowDestination(Destination d)

      Determines if a connection to the given destination should be allowed.

      Checks the destination against known and unknown destination trackers. If the destination has exceeded its threshold for the current time window, the connection is denied. Unknown destinations start with the default threshold.

      Specified by:
        `allowDestination` in interface `IncomingConnectionFilter`
      Parameters:
        `d` - the destination to check
      Returns:
        true if the connection should be allowed, false if denied

    - #### start

          public void start()

      Starts the filter's background tasks.

      Initializes the purger and syncer timers to begin tracking connection attempts and periodically saving state to disk.

      Specified by:
        `start` in interface `StatefulConnectionFilter`

    - #### stop

          public void stop()

      Stops the filter's background tasks.

      Halts the purger and syncer timers. Existing connection data is retained until the next purge cycle.

      Specified by:
        `stop` in interface `StatefulConnectionFilter`