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 TypeMethodDescriptionvoidAdds a range.voidExplicitly bans an addressvoidExplicitly 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 rangesbooleanThe filter either allows defined ranges to be allowed or denied accesslongGets the last time the filter set was updated or marked as up to dateintreturns length of banned ip listintreturns length of blocked ip listintreturns length of ranges listIPRange[]Gets the current set of defined IP rangesbooleanTest if ipfilter is enabled or notbooleanChecks an address to see if its in an allowed rangevoidreload()Reloads the ip filter from the config file (obtainable using "getFile")voidremoveRange(IPRange range) Remove a rangevoidsave()saves current setting to file given by getFilevoidsetEnabled(boolean enabled) change the enabled statusvoidsetInRangeAddressesAreAllowed(boolean b) Set the behaviour of the filter to either allow or deny access for defined rangesvoidRemoves a ban on an address
-
Field Details
-
filter
-
-
Constructor Details
-
IPFilterImpl
public IPFilterImpl()
-
-
Method Details
-
getFile
-
reload
Description copied from interface:IPFilterReloads the ip filter from the config file (obtainable using "getFile")- Specified by:
reloadin interfaceIPFilter- Throws:
IPFilterException
-
save
Description copied from interface:IPFiltersaves current setting to file given by getFile- Specified by:
savein interfaceIPFilter- Throws:
IPFilterException
-
getRanges
-
getNumberOfRanges
public int getNumberOfRanges()Description copied from interface:IPFilterreturns length of ranges list- Specified by:
getNumberOfRangesin interfaceIPFilter- Returns:
-
getNumberOfBlockedIPs
public int getNumberOfBlockedIPs()Description copied from interface:IPFilterreturns length of blocked ip list- Specified by:
getNumberOfBlockedIPsin interfaceIPFilter- Returns:
-
getNumberOfBannedIPs
public int getNumberOfBannedIPs()Description copied from interface:IPFilterreturns length of banned ip list- Specified by:
getNumberOfBannedIPsin interfaceIPFilter- Returns:
-
isInRange
-
createRange
Description copied from interface:IPFiltercreates a new range but *doesn't* add it to the list. Use the add method to add it- Specified by:
createRangein interfaceIPFilter- Parameters:
address_type- - 1= ipv4, 2=ipv6this_session_only- // not persisted if "this_session_only" is true- Returns:
-
addRange
-
createAndAddRange
public IPRange createAndAddRange(String description, String start_ip, String end_ip, boolean this_session_only) Description copied from interface:IPFilterCreates, validates and adds a range- Specified by:
createAndAddRangein interfaceIPFilter- Parameters:
description-start_ip-end_ip-this_session_only- not persisted if true- Returns:
- new range or null if invalid
-
removeRange
Description copied from interface:IPFilterRemove a range- Specified by:
removeRangein interfaceIPFilter- Parameters:
range-
-
getBlockedIPs
Description copied from interface:IPFilterGets the current list of blocked addresses- Specified by:
getBlockedIPsin interfaceIPFilter- Returns:
-
block
-
getBannedIPs
Description copied from interface:IPFilterGets the current list of b addresses- Specified by:
getBannedIPsin interfaceIPFilter- Returns:
-
ban
-
unban
-
isEnabled
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:IPFilterchange the enabled status- Specified by:
setEnabledin interfaceIPFilter- Parameters:
enabled-
-
getInRangeAddressesAreAllowed
public boolean getInRangeAddressesAreAllowed()Description copied from interface:IPFilterThe filter either allows defined ranges to be allowed or denied access- Specified by:
getInRangeAddressesAreAllowedin interfaceIPFilter- Returns:
-
setInRangeAddressesAreAllowed
public void setInRangeAddressesAreAllowed(boolean b) Description copied from interface:IPFilterSet the behaviour of the filter to either allow or deny access for defined ranges- Specified by:
setInRangeAddressesAreAllowedin interfaceIPFilter- Parameters:
b-
-
getLastUpdateTime
public long getLastUpdateTime()Description copied from interface:IPFilterGets the last time the filter set was updated or marked as up to date- Specified by:
getLastUpdateTimein interfaceIPFilter- Returns:
-