See: Description
Interface | Description |
---|---|
IpFilteringHandler |
The Interface IpFilteringHandler.
|
IpFilterListener |
The listener interface for receiving ipFilter events.
|
IpFilterRule |
This Interface defines an Ip Filter Rule.
|
IpSet |
This Interface defines an IpSet object.
|
Class | Description |
---|---|
CIDR | |
CIDR4 | |
CIDR6 | |
IpFilteringHandlerImpl |
General class that handle Ip Filtering.
|
IpFilterRuleHandler |
Implementation of Filter of IP based on ALLOW and DENY rules.
This implementation could be changed by implementing a new IpFilterRule than default
IpV4SubnetFilterRule (IPV4 support only), IpSubnetFilterRule (IPV4 and IPV6 support)
or IpFilterRule (IP and host name string pattern support) .The check is done by going from step to step in the underlying array of IpFilterRule. Each IpFilterRule answers to the method accept if the InetAddress is accepted or not,
according to its implementation. |
IpFilterRuleList |
The Class IpFilterRuleList is a helper class to generate a List of Rules from a string.
|
IpSubnet |
This class allows to check if an IP V4 or V6 Address is contained in a subnet.
Supported IP V4 Formats for the Subnets are: 1.1.1.1/255.255.255.255 or 1.1.1.1/32 (CIDR-Notation) and (InetAddress,Mask) where Mask is a integer for CIDR-notation or a String for Standard Mask notation. Example1: IpV4Subnet ips = new IpV4Subnet("192.168.1.0/24"); System.out.println("Result: "+ ips.contains("192.168.1.123")); System.out.println("Result: "+ ips.contains(inetAddress2)); Example1 bis: IpV4Subnet ips = new IpV4Subnet(inetAddress, 24); where inetAddress is 192.168.1.0 and inetAddress2 is 192.168.1.123 Example2: IpV4Subnet ips = new IpV4Subnet("192.168.1.0/255.255.255.0"); System.out.println("Result: "+ ips.contains("192.168.1.123")); System.out.println("Result: "+ ips.contains(inetAddress2)); Example2 bis: IpV4Subnet ips = new IpV4Subnet(inetAddress, "255.255.255.0"); where inetAddress is 192.168.1.0 and inetAddress2 is 192.168.1.123 Supported IP V6 Formats for the Subnets are: a:b:c:d:e:f:g:h/NN (CIDR-Notation) or any IPV6 notations (like a:b:c:d::/NN, a:b:c:d:e:f:w.x.y.z/NN) and (InetAddress,Mask) where Mask is a integer for CIDR-notation and (InetAddress,subnet). Example1: IpSubnet ips = new IpSubnet("1fff:0:0a88:85a3:0:0:0:0/24"); IpSubnet ips = new IpSubnet("1fff:0:0a88:85a3::/24"); System.out.println("Result: "+ ips.contains("1fff:0:0a88:85a3:0:0:ac1f:8001")); System.out.println("Result: "+ ips.contains(inetAddress2)); Example1 bis: IpSubnet ips = new IpSubnet(inetAddress, 24); where inetAddress2 is 1fff:0:0a88:85a3:0:0:ac1f:8001 |
IpSubnetFilterRule |
Ip V4 and Ip V6 filter rule.
Note that mix of IPV4 and IPV6 is allowed but it is not recommended. |
IpV4Subnet |
This class allows to check if an IP-V4-Address is contained in a subnet.
Supported Formats for the Subnets are: 1.1.1.1/255.255.255.255 or 1.1.1.1/32 (CIDR-Notation) and (InetAddress,Mask) where Mask is a integer for CIDR-notation or a String for Standard Mask notation. Example1: IpV4Subnet ips = new IpV4Subnet("192.168.1.0/24"); System.out.println("Result: "+ ips.contains("192.168.1.123")); System.out.println("Result: "+ ips.contains(inetAddress2)); Example1 bis: IpV4Subnet ips = new IpV4Subnet(inetAddress, 24); where inetAddress is 192.168.1.0 and inetAddress2 is 192.168.1.123 Example2: IpV4Subnet ips = new IpV4Subnet("192.168.1.0/255.255.255.0"); System.out.println("Result: "+ ips.contains("192.168.1.123")); System.out.println("Result: "+ ips.contains(inetAddress2)); Example2 bis: IpV4Subnet ips = new IpV4Subnet(inetAddress, "255.255.255.0"); where inetAddress is 192.168.1.0 and inetAddress2 is 192.168.1.123 |
IpV4SubnetFilterRule |
IpV4 only Filter Rule
|
OneIpFilterHandler |
Handler that block any new connection if there are already a currently active
channel connected with the same InetAddress (IP).
Take care to not change isBlocked method except if you know what you are doing since it is used to test if the current closed connection is to be removed or not from the map of currently connected channel. |
PatternRule |
The Class PatternRule represents an IP filter rule using string patterns.
|
The main goal of this package is to allow to filter connections based on IP rules.
The main interface is IpFilteringHandler
which
all filters will extend.
Two IP filtering are proposed:
OneIpFilterHandler
: This filter proposes to allow
only one connection by client's IP Address. I.E. this filter will prevent two connections
from the same client based on its IP address.IpFilterRuleHandler
: This filter proposes to allow
or block IP range (based on standard notation or on CIDR notation) when the connection is
running. It relies on another class like IpV4SubnetFilterRule (IPV4 support only),
IpSubnetFilterRule (IPV4 and IPV6 support) or PatternRule (string pattern
support) which implements those Ip ranges.Standard use could be as follow: The accept method must be overridden (of course you can override others).
IpFilterListener
or returns null if no listener has been set.
IpFilterListener
or returns false if no listener has been set.
ChannelPipeline
pipeline = ...;
IpFilterRuleHandler firewall = new IpFilterRuleHandler();
firewall.addAll(new IpFilterRuleList("+n:localhost, +c:192.168.0.0/27, -n:*"));
pipeline.addFirst("firewall", firewall);
Copyright © 2008-2012 The Netty Project. All Rights Reserved.