Package com.linecorp.armeria.common.util
Class InetAddressPredicates
java.lang.Object
com.linecorp.armeria.common.util.InetAddressPredicates
A utility class which provides factory methods in order to easily create a
Predicate
of an
InetAddress
.-
Method Summary
Modifier and TypeMethodDescriptionstatic Predicate
<InetAddress> Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.static Predicate
<InetAddress> ofCidr
(InetAddress baseAddress, int maskBits) Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.static Predicate
<InetAddress> ofCidr
(InetAddress baseAddress, String subnetMask) Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.static Predicate
<InetAddress> static Predicate
<InetAddress> ofExact
(InetAddress address)
-
Method Details
-
ofExact
- Parameters:
address
- the expectedInetAddress
-
ofExact
- Parameters:
address
- the expected IP address string, e.g.10.0.0.1
-
ofCidr
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.- Parameters:
baseAddress
- the baseInetAddress
of a CIDR notationmaskBits
- the number of significant bits which describes its network portion
-
ofCidr
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.- Parameters:
baseAddress
- the baseInetAddress
of a CIDR notationsubnetMask
- the subnet mask, e.g.255.255.255.0
-
ofCidr
Returns aPredicate
which returnstrue
if the givenInetAddress
is in the range of a Classless Inter-domain Routing (CIDR) block.- Parameters:
cidr
- the CIDR notation of an address block, e.g.10.0.0.0/8
,192.168.1.0/24
,1080:0:0:0:8:800:200C:4100/120
. If it's an exact IP address such as10.1.1.7
or1080:0:0:0:8:800:200C:4100
, the mask bits is considered as32
for IPv4 or128
for IPv6.
-