|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.atlassian.ip.IPMatcher
public class IPMatcher
A Flexible, immutable, IP address matcher. Matches IP addresses against an internal database of IP addresses and IP subnets.
Performs DNS lookups only when adding hosts names using IPMatcher.Builder.addPatternOrHost(String).
If using host names, instances of this class should be regularly discarded
as any changes to DNS will not be picked up after the instance has been
created.
Example usage:
final IPMatcher ipMatcher = IPMatcher.builder()
.addPatternOrHost("example.org")
.addPattern("192.168.1.0/24")
.build();
ipMatcher.match("192.168.1.13");
| Nested Class Summary | |
|---|---|
static class |
IPMatcher.Builder
A builder for creating immutable IPMatcher instances. |
| Method Summary | |
|---|---|
static IPMatcher.Builder |
builder()
Returns a new builder. |
static boolean |
isValidPatternOrHost(java.lang.String patternOrHost)
|
boolean |
matches(java.net.InetAddress ipAddress)
Returns true if the given ip address matches one of the stored patterns. |
boolean |
matches(java.lang.String ipAddress)
Returns true if the given ip address matches one of the stored patterns. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public boolean matches(java.lang.String ipAddress)
ipAddress - ip address to match
java.lang.IllegalArgumentException - if the argument is not a valid IP string literalpublic boolean matches(java.net.InetAddress ipAddress)
ipAddress - ip address to match
public static boolean isValidPatternOrHost(java.lang.String patternOrHost)
public static IPMatcher.Builder builder()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||