public class DefaultIpFilter extends CopyOnWriteArraySet<org.apache.mina.filter.firewall.Subnet> implements IpFilter
IpFilter
interface, which uses
specific IP addresses or ranges of IP addresses that can be blocked or
allowed.Constructor and Description |
---|
DefaultIpFilter(IpFilterType type)
Creates a new instance of
DefaultIpFilter . |
DefaultIpFilter(IpFilterType type,
Collection<? extends org.apache.mina.filter.firewall.Subnet> collection)
Creates a new instance of
DefaultIpFilter . |
DefaultIpFilter(IpFilterType type,
String addresses)
Creates a new instance of
DefaultIpFilter . |
Modifier and Type | Method and Description |
---|---|
boolean |
accept(InetAddress address)
Tells whether or not the given IP address is accepted by this filter.
|
boolean |
add(String str)
Adds the given string representation of InetAddress or CIDR notation to
this filter.
|
IpFilterType |
getType()
Returns the type of this filter.
|
void |
setType(IpFilterType type)
Sets the type of this filter.
|
add, addAll, clear, contains, containsAll, equals, forEach, isEmpty, iterator, remove, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray
hashCode
toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
parallelStream, stream
public DefaultIpFilter(IpFilterType type)
DefaultIpFilter
.type
- the filter typepublic DefaultIpFilter(IpFilterType type, Collection<? extends org.apache.mina.filter.firewall.Subnet> collection)
DefaultIpFilter
.type
- the filter typecollection
- a collection of Subnet
s to filter out/in.public DefaultIpFilter(IpFilterType type, String addresses) throws NumberFormatException, UnknownHostException
DefaultIpFilter
.type
- the filter typeaddresses
- a comma, space, tab, LF separated list of IP addresses/CIDRs.UnknownHostException
- propagatedNumberFormatException
- propagatedpublic IpFilterType getType()
public void setType(IpFilterType type)
type
- the type of this filter.public boolean add(String str) throws NumberFormatException, UnknownHostException
str
- the string representation of InetAddress or CIDR notationtrue
, if the
given element was added to the filter; false
, if the
element already exists in the filter.NumberFormatException
- propagatedUnknownHostException
- propagatedpublic boolean accept(InetAddress address)
IpFilter
Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.