Package org.dspace.authenticate
Class IPMatcher
java.lang.Object
org.dspace.authenticate.IPMatcher
Quickly tests whether a given IP address matches an IP range. An
IPMatcher is initialized with a particular IP range specification.
Calls to match method will then quickly
determine whether a given IP falls within that range.
Supported range specifications are:
- Full IPv4 address, e.g.
12.34.56.78 - Full IPv6 address, e.g.
2001:18e8:3:171:218:8bff:fe2a:56a4 - Partial IPv4 address, e.g.
12.34(which matches any IP starting12.34) - IPv4 network/netmask, e.g.
18.25.0.0/255.255.0.0 - IPv4 or IPv6 CIDR slash notation, e.g.
18.25.0.0/16,2001:18e8:3:171::/64
- Version:
- $Revision$
- Author:
- Robert Tansley, Ben Bosman, Roeland Dillen
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
IPMatcher
Construct an IPMatcher that will test for the given IP specification- Parameters:
ipSpec- IP specification (full or partial address, network/netmask, network/cidr)- Throws:
IPMatcherException- if there is an error parsing the specification (i.e. it is somehow malformed)
-
-
Method Details
-
match
Determine whether the given full IP falls within the range thisIPMatcherwas initialized with.- Parameters:
ipIn- IP address as dot-delimited String- Returns:
trueif the IP matches the range of thisIPMatcher;falseotherwise- Throws:
IPMatcherException- if the IP passed in cannot be parsed correctly (i.e. is malformed)
-