IP Filters

Context

IP Filters are invoked upon each new connection. They are invoked one atfer one, following a chain. The filter method must return true or false. When the plugin returns false, the connection is dropped. Otherwise, chain goes on.

How to

These are the easiest plugins to implement. You just need to implement the interface IFilterIP :

public interface IFilterIP extends IGenericPlugin {
    public boolean checkIP(InetAddress input);
} 

Thats to say you have to implement the generic plugin methods defined in IGenericPlugin interface, plus the checkIP method. Remember that this method may be invoked from multiple thread on the same object instance. If you modify you object's state, ensure proper synchronization. InnetAddress is at the momment an Inet4ddress.

Examples

See source:trunk/jsmtpd/src/org/jsmtpd/plugins/inputIPFilters/BlackList.java

See source:trunk/jsmtpd/src/org/jsmtpd/plugins/inputIPFilters/RBLFilter.java