public final class IpSubnetFilterRule extends java.lang.Object implements IpFilterRule, java.lang.Comparable<IpSubnetFilterRule>
RuleBasedIpFilter
that group IP addresses into subnets.
Supports both, IPv4 and IPv6.构造器和说明 |
---|
IpSubnetFilterRule(java.net.InetAddress ipAddress,
int cidrPrefix,
IpFilterRuleType ruleType)
Create a new
IpSubnetFilterRule instance |
IpSubnetFilterRule(java.lang.String ipAddress,
int cidrPrefix,
IpFilterRuleType ruleType)
Create a new
IpSubnetFilterRule instance |
IpSubnetFilterRule(java.lang.String ipAddressWithCidr,
IpFilterRuleType ruleType)
Create a new
IpSubnetFilterRule instance |
限定符和类型 | 方法和说明 |
---|---|
int |
compareTo(IpSubnetFilterRule ipSubnetFilterRule) |
boolean |
matches(java.net.InetSocketAddress remoteAddress) |
IpFilterRuleType |
ruleType() |
public IpSubnetFilterRule(java.lang.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(java.lang.String ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
IpSubnetFilterRule
instanceipAddress
- IP Address as String
cidrPrefix
- CIDR PrefixruleType
- IpFilterRuleType
to usepublic IpSubnetFilterRule(java.net.InetAddress ipAddress, int cidrPrefix, IpFilterRuleType ruleType)
IpSubnetFilterRule
instanceipAddress
- IP Address as InetAddress
cidrPrefix
- CIDR PrefixruleType
- IpFilterRuleType
to usepublic boolean matches(java.net.InetSocketAddress remoteAddress)
matches
在接口中 IpFilterRule
public IpFilterRuleType ruleType()
ruleType
在接口中 IpFilterRule
IpFilterRuleType.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
在接口中 java.lang.Comparable<IpSubnetFilterRule>