465734 DosFilter whitelist bit pattern fix
removed conflicting setter
This commit is contained in:
parent
25474ff7ab
commit
b5818034eb
|
@ -1031,29 +1031,17 @@ public class DoSFilter implements Filter
|
||||||
/**
|
/**
|
||||||
* Set a list of IP addresses that will not be rate limited.
|
* Set a list of IP addresses that will not be rate limited.
|
||||||
*
|
*
|
||||||
* @param value comma-separated whitelist
|
* @param commaSeparatedList comma-separated whitelist
|
||||||
*/
|
*/
|
||||||
public void setWhitelist(String value)
|
public void setWhitelist(String commaSeparatedList)
|
||||||
{
|
{
|
||||||
List<String> result = new ArrayList<>();
|
List<String> result = new ArrayList<>();
|
||||||
for (String address : value.split(","))
|
for (String address : commaSeparatedList.split(","))
|
||||||
addWhitelistAddress(result, address);
|
addWhitelistAddress(result, address);
|
||||||
clearWhitelist();
|
clearWhitelist();
|
||||||
_whitelist.addAll(result);
|
_whitelist.addAll(result);
|
||||||
LOG.debug("Whitelisted IP addresses: {}", result);
|
LOG.debug("Whitelisted IP addresses: {}", result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set a list of IP addresses that will not be rate limited.
|
|
||||||
*
|
|
||||||
* @param values whitelist
|
|
||||||
*/
|
|
||||||
public void setWhitelist(List<String> values)
|
|
||||||
{
|
|
||||||
clearWhitelist();
|
|
||||||
_whitelist.addAll(values);
|
|
||||||
LOG.debug("Whitelisted IP addresses: {}", values);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears the list of whitelisted IP addresses
|
* Clears the list of whitelisted IP addresses
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class DoSFilterTest extends AbstractDoSFilterTest
|
||||||
whitelist.add("10.0.0.0/8");
|
whitelist.add("10.0.0.0/8");
|
||||||
whitelist.add("4d8:0:a:1234:ABc:1F:b18:17");
|
whitelist.add("4d8:0:a:1234:ABc:1F:b18:17");
|
||||||
whitelist.add("4d8:0:a:1234:ABc:1F:0:0/96");
|
whitelist.add("4d8:0:a:1234:ABc:1F:0:0/96");
|
||||||
filter.setWhitelist(whitelist);
|
filter.setWhitelist("192.168.0.1/32,10.0.0.0/8,4d8:0:a:1234:ABc:1F:b18:17,4d8:0:a:1234:ABc:1F:0:0/96");
|
||||||
Assert.assertTrue(filter.checkWhitelist("192.168.0.1"));
|
Assert.assertTrue(filter.checkWhitelist("192.168.0.1"));
|
||||||
Assert.assertFalse(filter.checkWhitelist("192.168.0.2"));
|
Assert.assertFalse(filter.checkWhitelist("192.168.0.2"));
|
||||||
Assert.assertFalse(filter.checkWhitelist("11.12.13.14"));
|
Assert.assertFalse(filter.checkWhitelist("11.12.13.14"));
|
||||||
|
|
Loading…
Reference in New Issue