java.lang.Object
ch.qos.logback.core.util.IpAddressMatcher
Matches an
InetAddress against a single IP address or a CIDR network
range.
Accepted forms:
- Single address:
192.168.1.10,2001:db8::1 - CIDR range:
192.168.1.0/24,2001:db8::/32
- Since:
- 1.6.2
- Author:
- Ceki Gülcü
-
Constructor Summary
ConstructorsConstructorDescriptionIpAddressMatcher(String addressOrCidr) Creates a matcher for the given address or CIDR specification. -
Method Summary
Modifier and TypeMethodDescriptionThe original specification used to construct this matcher.booleanReturnstrueif the given address string matches this matcher.booleanmatches(InetAddress address) Returnstrueif the given address matches this matcher.toString()
-
Constructor Details
-
IpAddressMatcher
Creates a matcher for the given address or CIDR specification.- Parameters:
addressOrCidr- a single IP oraddress/prefixLength- Throws:
IllegalArgumentException- if the specification is invalid
-
-
Method Details
-
matches
Returnstrueif the given address matches this matcher.- Parameters:
address- the address to test; may benull- Returns:
trueifaddressmatches
-
matches
Returnstrueif the given address string matches this matcher.- Parameters:
address- an IP address string- Returns:
trueif the address matches- Throws:
IllegalArgumentException- ifaddresscannot be parsed
-
getSpecification
The original specification used to construct this matcher. -
toString
-