public final class IpSubnetFilterRule extends Object implements IpFilterRule, Comparable<IpSubnetFilterRule>
RuleBasedIpFilter that group IP addresses into subnets.
Supports both, IPv4 and IPv6.| Constructor and Description |
|---|
IpSubnetFilterRule(InetAddress ipAddress,
int cidrPrefix,
IpFilterRuleType ruleType)
Create a new
IpSubnetFilterRule instance |
IpSubnetFilterRule(String ipAddress,
int cidrPrefix,
IpFilterRuleType ruleType)
Create a new
IpSubnetFilterRule instance |
IpSubnetFilterRule(String ipAddressWithCidr,
IpFilterRuleType ruleType)
Create a new
IpSubnetFilterRule instance |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(IpSubnetFilterRule ipSubnetFilterRule) |
boolean |
matches(InetSocketAddress remoteAddress) |
IpFilterRuleType |
ruleType() |
public IpSubnetFilterRule(String ipAddressWithCidr, IpFilterRuleType ruleType)
IpSubnetFilterRule instanceipAddressWithCidr - IP Address with CIDR notation, e.g. (192.168.0.0/16) or (2001:db8::/32)ruleType - IpFilterRuleType to usepublic IpSubnetFilterRule(String ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
IpSubnetFilterRule instanceipAddress - IP Address as StringcidrPrefix - CIDR PrefixruleType - IpFilterRuleType to usepublic IpSubnetFilterRule(InetAddress ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
IpSubnetFilterRule instanceipAddress - IP Address as InetAddresscidrPrefix - CIDR PrefixruleType - IpFilterRuleType to usepublic boolean matches(InetSocketAddress remoteAddress)
matches in interface IpFilterRulepublic IpFilterRuleType ruleType()
ruleType in interface IpFilterRuleIpFilterRuleType.ACCEPT if all
IpFilterRule.matches(InetSocketAddress) for which IpFilterRule.matches(InetSocketAddress)
returns true should the accepted. If you want to exclude all of those IP addresses then
IpFilterRuleType.REJECT should be returned.public int compareTo(IpSubnetFilterRule ipSubnetFilterRule)
compareTo in interface Comparable<IpSubnetFilterRule>Copyright © 2008–2025 The Netty Project. All rights reserved.