Package com.lahuca.botsentry.api
Class BotSentryList
- java.lang.Object
-
- com.lahuca.botsentry.api.BotSentryList
-
public class BotSentryList extends java.lang.Object
The base operations for the black- and whitelist.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.String ip)
Adds an IP to the list asynchronously.void
clear()
Clears this list fully asynchronously.void
contains(java.lang.String ip, java.util.function.Consumer<java.lang.Boolean> callback)
Gives the contains value of the given IP in this list asynchronously.void
get(java.util.function.Consumer<java.util.Set<java.lang.String>> callback)
Gives all IPs in this list asynchronously.boolean
isWhitelist()
Gives the list type of the current object in a boolean format.void
remove(java.lang.String ip)
Removes an IP from the list asynchronously.
-
-
-
Method Detail
-
isWhitelist
public boolean isWhitelist()
Gives the list type of the current object in a boolean format. True: whitelist, false: blacklist.- Returns:
- The list type.
-
contains
public void contains(java.lang.String ip, java.util.function.Consumer<java.lang.Boolean> callback) throws java.lang.IllegalArgumentException
Gives the contains value of the given IP in this list asynchronously.- Parameters:
ip
- The ip to check if it is inside the list.callback
- The callback object, it will return the contains value when it is retrieved asynchronously.- Throws:
java.lang.IllegalArgumentException
- If the IP is not in the correct IPv4 format.
-
add
public void add(java.lang.String ip) throws java.lang.IllegalArgumentException
Adds an IP to the list asynchronously. If the IP is already inside the list, it will do nothing.- Parameters:
ip
- The ip to add to the list.- Throws:
java.lang.IllegalArgumentException
- If the IP is not in the correct IPv4 format.
-
remove
public void remove(java.lang.String ip) throws java.lang.IllegalArgumentException
Removes an IP from the list asynchronously. If the IP is not in the list, it will do nothing.- Parameters:
ip
- The ip to remove from the list.- Throws:
java.lang.IllegalArgumentException
- If the IP is not in the correct IPv4 format.
-
get
public void get(java.util.function.Consumer<java.util.Set<java.lang.String>> callback)
Gives all IPs in this list asynchronously.- Parameters:
callback
- The callback object, it will return all IPs in this list when it is retrieved asynchronously.
-
clear
public void clear()
Clears this list fully asynchronously.
-
-