This class allows one to filter new Channels based on the
IpSubnetFilters passed to its constructor. If no rules are provided, all connections
will be accepted since acceptIfNotFound is true by default.
If you would like to explicitly take action on rejected Channels, you should override
AbstractRemoteAddressFilter#channelRejected(ChannelHandlerContext, SocketAddress).
Few Points to keep in mind:
IpSubnetFilter uses Binary search algorithm, it's a good
idea to insert IP addresses in incremental order. | Modifier and Type | Field and Description |
|---|---|
| private final boolean | |
| private final IpFilterRuleType | |
| private final IpFilterRuleType | |
| private final List | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public | IpSubnetFilter(IpSubnetFilterRule...
IpSubnetFilterRule as an array Create new |
| public | IpSubnetFilter(boolean
true if we'll accept connection if not found in rule(s).IpSubnetFilterRule as an array Create new |
| public | IpSubnetFilter(List<IpSubnetFilterRule>
IpSubnetFilterRule as a List Create new |
| public | IpSubnetFilter(boolean
true if we'll accept connection if not found in rule(s).IpSubnetFilterRule as a List Create new |
| Modifier and Type | Method and Description |
|---|---|
| protected boolean | accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress)
Implements abstract io. io. gets registered.
|
| public boolean | isSharable()
Overrides default io. true if this handler is sharable and thus can be added
to more than one ChannelPipeline.
|
| private static List | sortAndFilter(List<IpSubnetFilterRule> rules)
|
| acceptIfNotFound | back to summary |
|---|---|
| private final boolean acceptIfNotFound | |
| ipFilterRuleTypeIPv4 | back to summary |
|---|---|
| private final IpFilterRuleType ipFilterRuleTypeIPv4 | |
| ipFilterRuleTypeIPv6 | back to summary |
|---|---|
| private final IpFilterRuleType ipFilterRuleTypeIPv6 | |
| ipv4Rules | back to summary |
|---|---|
| private final List<IpSubnetFilterRule> ipv4Rules | |
| ipv6Rules | back to summary |
|---|---|
| private final List<IpSubnetFilterRule> ipv6Rules | |
| IpSubnetFilter | back to summary |
|---|---|
| public IpSubnetFilter(IpSubnetFilterRule... rules) Create new
| |
| IpSubnetFilter | back to summary |
|---|---|
| public IpSubnetFilter(boolean acceptIfNotFound, IpSubnetFilterRule... rules) Create new
| |
| IpSubnetFilter | back to summary |
|---|---|
| public IpSubnetFilter(List<IpSubnetFilterRule> rules) Create new
| |
| IpSubnetFilter | back to summary |
|---|---|
| public IpSubnetFilter(boolean acceptIfNotFound, List<IpSubnetFilterRule> rules) Create new
| |
| accept | back to summary |
|---|---|
| protected boolean accept(ChannelHandlerContext ctx, InetSocketAddress remoteAddress) Implements abstract io. Doc from io. This method is called immediately after a
| |
| isSharable | back to summary |
|---|---|
| public boolean isSharable() Overrides default io. Doc from io. Returns
| |
| sortAndFilter | back to summary |
|---|---|
private static List
| |