Package com.biglybt.pif.ipfilter
Interface IPFilter
- All Known Implementing Classes:
IPFilterImpl
,RPIPFilter
public interface IPFilter
-
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
-
Method Details
-
getFile
File getFile()Gets the file name used for persistent ranges- Returns:
-
createRange
creates a new range but *doesn't* add it to the list. Use the add method to add it- Parameters:
address_type
- - 1= ipv4, 2=ipv6this_session_only
- // not persisted if "this_session_only" is true- Returns:
-
addRange
Adds a range. Only ranges created with "create" above can be added- Parameters:
range
-
-
createAndAddRange
IPRange createAndAddRange(String description, String start_ip, String end_ip, boolean this_session_only) Creates, validates and adds a range- Parameters:
description
-start_ip
-end_ip
-this_session_only
- not persisted if true- Returns:
- new range or null if invalid
-
removeRange
Remove a range- Parameters:
range
-
-
reload
Reloads the ip filter from the config file (obtainable using "getFile")- Throws:
IPFilterException
-
getRanges
IPRange[] getRanges()Gets the current set of defined IP ranges- Returns:
-
getNumberOfRanges
int getNumberOfRanges()returns length of ranges list- Returns:
-
isInRange
Checks an address to see if its in an allowed range- Parameters:
IPAddress
-- Returns:
-
getBlockedIPs
IPBlocked[] getBlockedIPs()Gets the current list of blocked addresses- Returns:
-
getNumberOfBlockedIPs
int getNumberOfBlockedIPs()returns length of blocked ip list- Returns:
-
block
Explicitly blocks an address- Parameters:
IPAddress
-
-
getBannedIPs
IPBanned[] getBannedIPs()Gets the current list of b addresses- Returns:
- Since:
- 2.5.0.2
-
getNumberOfBannedIPs
int getNumberOfBannedIPs()returns length of banned ip list- Returns:
- Since:
- 2.5.0.2
-
ban
Explicitly bans an address- Parameters:
IPAddress
-- Since:
- 2.5.0.2
-
unban
Removes a ban on an address- Parameters:
IPAddress
-- Since:
- 2.5.0.2
-
getInRangeAddressesAreAllowed
boolean getInRangeAddressesAreAllowed()The filter either allows defined ranges to be allowed or denied access- Returns:
-
setInRangeAddressesAreAllowed
void setInRangeAddressesAreAllowed(boolean b) Set the behaviour of the filter to either allow or deny access for defined ranges- Parameters:
b
-
-
isEnabled
boolean isEnabled()Test if ipfilter is enabled or not- Returns:
-
setEnabled
void setEnabled(boolean enabled) change the enabled status- Parameters:
enabled
-
-
save
saves current setting to file given by getFile- Throws:
IPFilterException
-
getLastUpdateTime
long getLastUpdateTime()Gets the last time the filter set was updated or marked as up to date- Returns:
-