@ChannelHandler.Sharable public class IpFilterRuleHandler extends IpFilteringHandlerImpl
IpFilterRule
than default
IpV4SubnetFilterRule
(IPV4 support only), IpSubnetFilterRule
(IPV4 and IPV6 support)
or IpFilterRule
(IP and host name string pattern support) .IpFilterRule
answers to the method accept if the InetAddress
is accepted or not,
according to its implementation. If an InetAddress arrives at the end of the list, as in Firewall
usual rules, the InetAddress is therefore accepted by default.IpSubnetFilterRule
which supports IPV4 and IPV6 should be used with as much as
possible no mixed IP protocol. Both IPV4 and IPV6 are supported but a mix (IpFilter in IPV6 notation
and the address from the channel in IPV4, or the reverse) can lead to wrong result.ChannelHandler.Sharable
Constructor and Description |
---|
IpFilterRuleHandler()
Empty constructor (no IpFilterRule in the List at construction).
|
IpFilterRuleHandler(List<IpFilterRule> newList)
Constructor from a new list of IpFilterRule
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
accept(ChannelHandlerContext ctx,
ChannelEvent e,
InetSocketAddress inetSocketAddress)
Called when the channel is connected.
|
void |
add(int index,
IpFilterRule ipFilterRule)
Add an ipFilterRule in the list at the specified position (shifting to the right other elements)
|
void |
add(IpFilterRule ipFilterRule)
Add an ipFilterRule in the list at the end
|
void |
addAll(Collection<IpFilterRule> c)
Appends all of the elements in the specified collection to the end of this list,
in the order that they are returned by the specified collection's iterator.
|
void |
addAll(int index,
Collection<IpFilterRule> c)
Inserts all of the elements in the specified collection into this list, starting at the specified position.
|
int |
addAllAbsent(Collection<IpFilterRule> c)
Append the element if not present.
|
boolean |
addIfAbsent(IpFilterRule ipFilterRule)
Append the element if not present.
|
void |
clear()
Clear the list
|
boolean |
contains(IpFilterRule ipFilterRule)
Returns true if this list contains the specified element
|
boolean |
containsAll(Collection<IpFilterRule> c)
Returns true if this list contains all of the elements of the specified collection
|
IpFilterRule |
get(int index)
Returns the element at the specified position in this list
|
boolean |
isEmpty()
Returns true if this list contains no elements
|
IpFilterRule |
remove(int index)
Removes the element at the specified position in this list
|
void |
remove(IpFilterRule ipFilterRule)
Remove the ipFilterRule from the list
|
void |
removeAll(Collection<IpFilterRule> c)
Removes from this list all of its elements that are contained in the specified collection
|
void |
retainAll(Collection<IpFilterRule> c)
Retains only the elements in this list that are contained in the specified collection
|
IpFilterRule |
set(int index,
IpFilterRule ipFilterRule)
Replaces the element at the specified position in this list with the specified element
|
int |
size()
Returns the number of elements in this list.
|
continues, handleAllowedChannel, handleRefusedChannel, handleUpstream, isBlocked, removeIpFilterListener, setIpFilterListener
public IpFilterRuleHandler(List<IpFilterRule> newList)
public IpFilterRuleHandler()
public void add(IpFilterRule ipFilterRule)
public void add(int index, IpFilterRule ipFilterRule)
public void addAll(Collection<IpFilterRule> c)
public void addAll(int index, Collection<IpFilterRule> c)
public int addAllAbsent(Collection<IpFilterRule> c)
public boolean addIfAbsent(IpFilterRule ipFilterRule)
public void clear()
public boolean contains(IpFilterRule ipFilterRule)
public boolean containsAll(Collection<IpFilterRule> c)
public IpFilterRule get(int index)
public boolean isEmpty()
public void remove(IpFilterRule ipFilterRule)
public IpFilterRule remove(int index)
public void removeAll(Collection<IpFilterRule> c)
public void retainAll(Collection<IpFilterRule> c)
public IpFilterRule set(int index, IpFilterRule ipFilterRule)
public int size()
protected boolean accept(ChannelHandlerContext ctx, ChannelEvent e, InetSocketAddress inetSocketAddress) throws Exception
IpFilteringHandlerImpl
accept
in class IpFilteringHandlerImpl
inetSocketAddress
- the remote InetSocketAddress
from clientException
Copyright © 2008-2014 The Netty Project. All Rights Reserved.