Package io.netty.handler.ipfilter
Class IpSubnetFilterRule.Ip4SubnetFilterRule
- java.lang.Object
-
- io.netty.handler.ipfilter.IpSubnetFilterRule.Ip4SubnetFilterRule
-
- All Implemented Interfaces:
IpFilterRule
- Enclosing class:
- IpSubnetFilterRule
private static final class IpSubnetFilterRule.Ip4SubnetFilterRule extends java.lang.Object implements IpFilterRule
-
-
Field Summary
Fields Modifier and Type Field Description private int
networkAddress
private IpFilterRuleType
ruleType
private int
subnetMask
-
Constructor Summary
Constructors Modifier Constructor Description private
Ip4SubnetFilterRule(java.net.Inet4Address ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static int
ipToInt(java.net.Inet4Address ipAddress)
boolean
matches(java.net.InetSocketAddress remoteAddress)
private static int
prefixToSubnetMask(int cidrPrefix)
IpFilterRuleType
ruleType()
-
-
-
Field Detail
-
networkAddress
private final int networkAddress
-
subnetMask
private final int subnetMask
-
ruleType
private final IpFilterRuleType ruleType
-
-
Constructor Detail
-
Ip4SubnetFilterRule
private Ip4SubnetFilterRule(java.net.Inet4Address ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
-
-
Method Detail
-
matches
public boolean matches(java.net.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.
-
ipToInt
private static int ipToInt(java.net.Inet4Address ipAddress)
-
prefixToSubnetMask
private static int prefixToSubnetMask(int cidrPrefix)
-
-