-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathDatabaseProvider.java
More file actions
218 lines (198 loc) · 9.47 KB
/
Copy pathDatabaseProvider.java
File metadata and controls
218 lines (198 loc) · 9.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
package com.maxmind.geoip2;
import com.maxmind.geoip2.exception.GeoIp2Exception;
import com.maxmind.geoip2.model.AnonymousIpResponse;
import com.maxmind.geoip2.model.AnonymousPlusResponse;
import com.maxmind.geoip2.model.AsnResponse;
import com.maxmind.geoip2.model.CityResponse;
import com.maxmind.geoip2.model.ConnectionTypeResponse;
import com.maxmind.geoip2.model.CountryResponse;
import com.maxmind.geoip2.model.DomainResponse;
import com.maxmind.geoip2.model.EnterpriseResponse;
import com.maxmind.geoip2.model.IpRiskResponse;
import com.maxmind.geoip2.model.IspResponse;
import java.io.IOException;
import java.net.InetAddress;
import java.util.Optional;
/**
* Interface for GeoIP database providers.
*/
public interface DatabaseProvider extends GeoIp2Provider {
/**
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return A Country model for the requested IP address or empty if it is not in the DB.
* @throws GeoIp2Exception if there is an error looking up the IP
* @throws IOException if there is an IO error
*/
Optional<CountryResponse> tryCountry(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return A City model for the requested IP address or empty if it is not in the DB.
* @throws GeoIp2Exception if there is an error looking up the IP
* @throws IOException if there is an IO error
*/
Optional<CityResponse> tryCity(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Anonymous IP.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an AnonymousIpResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
AnonymousIpResponse anonymousIp(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Anonymous IP.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an AnonymousIpResponse for the requested IP address or empty if it is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<AnonymousIpResponse> tryAnonymousIp(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Anonymous Plus.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an AnonymousPlusResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
AnonymousPlusResponse anonymousPlus(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Anonymous Plus.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an AnonymousPlusResponse for the requested IP address or empty if it
* is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<AnonymousPlusResponse> tryAnonymousPlus(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP IP Risk database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an IpRiskResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
IpRiskResponse ipRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP IP Risk database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an IpRiskResponse for the requested IP address or empty if it is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<IpRiskResponse> tryIpRisk(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoLite ASN database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an AsnResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
AsnResponse asn(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoLite ASN database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an AsnResponse for the requested IP address or empty if it is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<AsnResponse> tryAsn(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Connection Type database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return a ConnectionTypeResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
ConnectionTypeResponse connectionType(InetAddress ipAddress)
throws IOException, GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Connection Type database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return a ConnectionTypeResponse for the requested IP address or empty if it
* is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<ConnectionTypeResponse> tryConnectionType(InetAddress ipAddress)
throws IOException, GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Domain database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return a DomainResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
DomainResponse domain(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Domain database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return a DomainResponse for the requested IP address or empty if it is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<DomainResponse> tryDomain(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Enterprise database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an EnterpriseResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
EnterpriseResponse enterprise(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP Enterprise database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an EnterpriseResponse for the requested IP address or empty if it is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<EnterpriseResponse> tryEnterprise(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP ISP database.
*
* @param ipAddress IPv4 or IPv6 address to lookup.
* @return an IspResponse for the requested IP address.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
IspResponse isp(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
/**
* Look up an IP address in a GeoIP ISP database.
*
* @param ipAddress IPv4 or IPv6 address to look up.
* @return an IspResponse for the requested IP address or empty if it is not in the DB.
* @throws com.maxmind.geoip2.exception.GeoIp2Exception if there is an error looking up the IP
* @throws java.io.IOException if there is an IO error
*/
Optional<IspResponse> tryIsp(InetAddress ipAddress) throws IOException,
GeoIp2Exception;
}