Package io.ipinfo.api
Class IPinfo
java.lang.Object
io.ipinfo.api.IPinfo
public class IPinfo extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classIPinfo.BatchReqOptsstatic classIPinfo.Builder -
Method Summary
Modifier and Type Method Description static StringcacheKey(String k)Converts a normal key into a versioned cache key.ConcurrentHashMap<String,Object>getBatch(List<String> urls)Get the result of a list of URLs in bulk.ConcurrentHashMap<String,Object>getBatch(List<String> urls, IPinfo.BatchReqOpts opts)Get the result of a list of URLs in bulk.ConcurrentHashMap<String,ASNResponse>getBatchAsns(List<String> asns)Get the result of a list of ASNs in bulk.ConcurrentHashMap<String,ASNResponse>getBatchAsns(List<String> asns, IPinfo.BatchReqOpts opts)Get the result of a list of ASNs in bulk.ConcurrentHashMap<String,IPResponse>getBatchIps(List<String> ips)Get the result of a list of IPs in bulk.ConcurrentHashMap<String,IPResponse>getBatchIps(List<String> ips, IPinfo.BatchReqOpts opts)Get the result of a list of IPs in bulk.StringgetMap(List<String> ips)Get a map of a list of IPs.ASNResponselookupASN(String asn)Lookup ASN information using the AS number.IPResponselookupIP(String ip)Lookup IP information using the IP.static voidmain(String... args)
-
Method Details
-
main
-
lookupIP
Lookup IP information using the IP.- Parameters:
ip- the ip string to lookup - accepts both ipv4 and ipv6.- Returns:
- IPResponse response from the api.
- Throws:
RateLimitedException- an exception when your api key has been rate limited.
-
lookupASN
Lookup ASN information using the AS number.- Parameters:
asn- the asn string to lookup.- Returns:
- ASNResponse response from the api.
- Throws:
RateLimitedException- an exception when your api key has been rate limited.
-
getMap
Get a map of a list of IPs.- Parameters:
ips- the list of IPs to map.- Returns:
- String the URL to the map.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
getBatch
Get the result of a list of URLs in bulk.- Parameters:
urls- the list of URLs.- Returns:
- the result where each URL is the key and the value is the data for that URL.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
getBatch
public ConcurrentHashMap<String,Object> getBatch(List<String> urls, IPinfo.BatchReqOpts opts) throws RateLimitedExceptionGet the result of a list of URLs in bulk.- Parameters:
urls- the list of URLs.opts- options to modify the behavior of the batch operation.- Returns:
- the result where each URL is the key and the value is the data for that URL.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
getBatchIps
public ConcurrentHashMap<String,IPResponse> getBatchIps(List<String> ips) throws RateLimitedExceptionGet the result of a list of IPs in bulk.- Parameters:
ips- the list of IPs.- Returns:
- the result where each IP is the key and the value is the data for that IP.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
getBatchIps
public ConcurrentHashMap<String,IPResponse> getBatchIps(List<String> ips, IPinfo.BatchReqOpts opts) throws RateLimitedExceptionGet the result of a list of IPs in bulk.- Parameters:
ips- the list of IPs.opts- options to modify the behavior of the batch operation.- Returns:
- the result where each IP is the key and the value is the data for that IP.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
getBatchAsns
public ConcurrentHashMap<String,ASNResponse> getBatchAsns(List<String> asns) throws RateLimitedExceptionGet the result of a list of ASNs in bulk.- Parameters:
asns- the list of ASNs.- Returns:
- the result where each ASN is the key and the value is the data for that ASN.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
getBatchAsns
public ConcurrentHashMap<String,ASNResponse> getBatchAsns(List<String> asns, IPinfo.BatchReqOpts opts) throws RateLimitedExceptionGet the result of a list of ASNs in bulk.- Parameters:
asns- the list of ASNs.opts- options to modify the behavior of the batch operation.- Returns:
- the result where each ASN is the key and the value is the data for that ASN.
- Throws:
RateLimitedException- an exception when your API key has been rate limited.
-
cacheKey
Converts a normal key into a versioned cache key.- Parameters:
k- the key to convert into a versioned cache key.- Returns:
- the versioned cache key.
-