Package io.netty.handler.ipfilter
Class IpSubnetFilterRule
- java.lang.Object
- 
- io.netty.handler.ipfilter.IpSubnetFilterRule
 
- 
- All Implemented Interfaces:
- IpFilterRule,- java.lang.Comparable<IpSubnetFilterRule>
 
 public final class IpSubnetFilterRule extends java.lang.Object implements IpFilterRule, java.lang.Comparable<IpSubnetFilterRule> Use this class to create rules forRuleBasedIpFilterthat group IP addresses into subnets. Supports both, IPv4 and IPv6.
- 
- 
Constructor SummaryConstructors Constructor Description IpSubnetFilterRule(java.lang.String ipAddress, int cidrPrefix, IpFilterRuleType ruleType)Create a newIpSubnetFilterRuleinstanceIpSubnetFilterRule(java.lang.String ipAddressWithCidr, IpFilterRuleType ruleType)Create a newIpSubnetFilterRuleinstanceIpSubnetFilterRule(java.net.InetAddress ipAddress, int cidrPrefix, IpFilterRuleType ruleType)Create a newIpSubnetFilterRuleinstance
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(IpSubnetFilterRule ipSubnetFilterRule)booleanmatches(java.net.InetSocketAddress remoteAddress)IpFilterRuleTyperuleType()
 
- 
- 
- 
Constructor Detail- 
IpSubnetFilterRulepublic IpSubnetFilterRule(java.lang.String ipAddressWithCidr, IpFilterRuleType ruleType)Create a newIpSubnetFilterRuleinstance- Parameters:
- ipAddressWithCidr- IP Address with CIDR notation, e.g. (192.168.0.0/16) or (2001:db8::/32)
- ruleType-- IpFilterRuleTypeto use
 
 - 
IpSubnetFilterRulepublic IpSubnetFilterRule(java.lang.String ipAddress, int cidrPrefix, IpFilterRuleType ruleType)Create a newIpSubnetFilterRuleinstance- Parameters:
- ipAddress- IP Address as- String
- cidrPrefix- CIDR Prefix
- ruleType-- IpFilterRuleTypeto use
 
 - 
IpSubnetFilterRulepublic IpSubnetFilterRule(java.net.InetAddress ipAddress, int cidrPrefix, IpFilterRuleType ruleType)Create a newIpSubnetFilterRuleinstance- Parameters:
- ipAddress- IP Address as- InetAddress
- cidrPrefix- CIDR Prefix
- ruleType-- IpFilterRuleTypeto use
 
 
- 
 - 
Method Detail- 
matchespublic boolean matches(java.net.InetSocketAddress remoteAddress) - Specified by:
- matchesin interface- IpFilterRule
- Returns:
- This method should return true if remoteAddress is valid according to your criteria. False otherwise.
 
 - 
ruleTypepublic IpFilterRuleType ruleType() - Specified by:
- ruleTypein interface- IpFilterRule
- Returns:
- This method should return IpFilterRuleType.ACCEPTif allIpFilterRule.matches(InetSocketAddress)for whichIpFilterRule.matches(InetSocketAddress)returns true should the accepted. If you want to exclude all of those IP addresses thenIpFilterRuleType.REJECTshould be returned.
 
 - 
compareTopublic int compareTo(IpSubnetFilterRule ipSubnetFilterRule) - Specified by:
- compareToin interface- java.lang.Comparable<IpSubnetFilterRule>
 
 
- 
 
-