- java.lang.Object
-
- io.netty5.handler.ipfilter.IpSubnetFilterRule
-
- All Implemented Interfaces:
IpFilterRule
,Comparable<IpSubnetFilterRule>
public final class IpSubnetFilterRule extends Object implements IpFilterRule, Comparable<IpSubnetFilterRule>
Use this class to create rules forRuleBasedIpFilter
that group IP addresses into subnets. Supports both, IPv4 and IPv6.
-
-
Constructor Summary
Constructors Constructor Description IpSubnetFilterRule(String ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
IpSubnetFilterRule(InetAddress ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(IpSubnetFilterRule ipSubnetFilterRule)
boolean
matches(InetSocketAddress remoteAddress)
IpFilterRuleType
ruleType()
-
-
-
Constructor Detail
-
IpSubnetFilterRule
public IpSubnetFilterRule(String ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
-
IpSubnetFilterRule
public IpSubnetFilterRule(InetAddress ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
-
-
Method Detail
-
matches
public boolean matches(InetSocketAddress remoteAddress)
- Specified by:
matches
in interfaceIpFilterRule
- Returns:
- This method should return true if remoteAddress is valid according to your criteria. False otherwise.
-
ruleType
public IpFilterRuleType ruleType()
- Specified by:
ruleType
in interfaceIpFilterRule
- Returns:
- This method should return
IpFilterRuleType.ACCEPT
if allIpFilterRule.matches(InetSocketAddress)
for whichIpFilterRule.matches(InetSocketAddress)
returns true should the accepted. If you want to exclude all of those IP addresses thenIpFilterRuleType.REJECT
should be returned.
-
compareTo
public int compareTo(IpSubnetFilterRule ipSubnetFilterRule)
- Specified by:
compareTo
in interfaceComparable<IpSubnetFilterRule>
-
-