Class IPFilterImpl
java.lang.Object
com.biglybt.pifimpl.local.ipfilter.IPFilterImpl
- All Implemented Interfaces:
IPFilter
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a range.void
Explicitly bans an addressvoid
Explicitly blocks an addresscreateAndAddRange
(String description, String start_ip, String end_ip, boolean this_session_only) Creates, validates and adds a rangecreateRange
(int address_type, boolean this_session_only) creates a new range but *doesn't* add it to the list.IPBanned[]
Gets the current list of b addressesGets the current list of blocked addressesgetFile()
Gets the file name used for persistent rangesboolean
The filter either allows defined ranges to be allowed or denied accesslong
Gets the last time the filter set was updated or marked as up to dateint
returns length of banned ip listint
returns length of blocked ip listint
returns length of ranges listIPRange[]
Gets the current set of defined IP rangesboolean
Test if ipfilter is enabled or notboolean
Checks an address to see if its in an allowed rangevoid
reload()
Reloads the ip filter from the config file (obtainable using "getFile")void
removeRange
(IPRange range) Remove a rangevoid
save()
saves current setting to file given by getFilevoid
setEnabled
(boolean enabled) change the enabled statusvoid
setInRangeAddressesAreAllowed
(boolean b) Set the behaviour of the filter to either allow or deny access for defined rangesvoid
Removes a ban on an address
-
Field Details
-
filter
-
-
Constructor Details
-
IPFilterImpl
public IPFilterImpl()
-
-
Method Details
-
getFile
Description copied from interface:IPFilter
Gets the file name used for persistent ranges -
reload
Description copied from interface:IPFilter
Reloads the ip filter from the config file (obtainable using "getFile")- Specified by:
reload
in interfaceIPFilter
- Throws:
IPFilterException
-
save
Description copied from interface:IPFilter
saves current setting to file given by getFile- Specified by:
save
in interfaceIPFilter
- Throws:
IPFilterException
-
getRanges
Description copied from interface:IPFilter
Gets the current set of defined IP ranges -
getNumberOfRanges
public int getNumberOfRanges()Description copied from interface:IPFilter
returns length of ranges list- Specified by:
getNumberOfRanges
in interfaceIPFilter
- Returns:
-
getNumberOfBlockedIPs
public int getNumberOfBlockedIPs()Description copied from interface:IPFilter
returns length of blocked ip list- Specified by:
getNumberOfBlockedIPs
in interfaceIPFilter
- Returns:
-
getNumberOfBannedIPs
public int getNumberOfBannedIPs()Description copied from interface:IPFilter
returns length of banned ip list- Specified by:
getNumberOfBannedIPs
in interfaceIPFilter
- Returns:
-
isInRange
Description copied from interface:IPFilter
Checks an address to see if its in an allowed range -
createRange
Description copied from interface:IPFilter
creates a new range but *doesn't* add it to the list. Use the add method to add it- Specified by:
createRange
in interfaceIPFilter
- Parameters:
address_type
- - 1= ipv4, 2=ipv6this_session_only
- // not persisted if "this_session_only" is true- Returns:
-
addRange
Description copied from interface:IPFilter
Adds a range. Only ranges created with "create" above can be added -
createAndAddRange
public IPRange createAndAddRange(String description, String start_ip, String end_ip, boolean this_session_only) Description copied from interface:IPFilter
Creates, validates and adds a range- Specified by:
createAndAddRange
in interfaceIPFilter
this_session_only
- not persisted if true- Returns:
- new range or null if invalid
-
removeRange
Description copied from interface:IPFilter
Remove a range- Specified by:
removeRange
in interfaceIPFilter
-
getBlockedIPs
Description copied from interface:IPFilter
Gets the current list of blocked addresses- Specified by:
getBlockedIPs
in interfaceIPFilter
- Returns:
-
block
Description copied from interface:IPFilter
Explicitly blocks an address -
getBannedIPs
Description copied from interface:IPFilter
Gets the current list of b addresses- Specified by:
getBannedIPs
in interfaceIPFilter
- Returns:
-
ban
Description copied from interface:IPFilter
Explicitly bans an address -
unban
Description copied from interface:IPFilter
Removes a ban on an address -
isEnabled
public boolean isEnabled()Description copied from interface:IPFilter
Test if ipfilter is enabled or not -
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:IPFilter
change the enabled status- Specified by:
setEnabled
in interfaceIPFilter
-
getInRangeAddressesAreAllowed
public boolean getInRangeAddressesAreAllowed()Description copied from interface:IPFilter
The filter either allows defined ranges to be allowed or denied access- Specified by:
getInRangeAddressesAreAllowed
in interfaceIPFilter
- Returns:
-
setInRangeAddressesAreAllowed
public void setInRangeAddressesAreAllowed(boolean b) Description copied from interface:IPFilter
Set the behaviour of the filter to either allow or deny access for defined ranges- Specified by:
setInRangeAddressesAreAllowed
in interfaceIPFilter
-
getLastUpdateTime
public long getLastUpdateTime()Description copied from interface:IPFilter
Gets the last time the filter set was updated or marked as up to date- Specified by:
getLastUpdateTime
in interfaceIPFilter
- Returns:
-