MaxMind.GeoIP2
Instances of this class provide a reader for the GeoIP2 database format
This class provides the interface implemented by both
and .
Returns an for the specified ip address.
The ip address.
An
Returns an for the specified ip address.
The ip address.
An
Initializes a new instance of the class.
The MaxMind DB file.
The mode by which to access the DB file.
Initializes a new instance of the class.
The MaxMind DB file.
List of locale codes to use in name property from most preferred to least preferred.
The mode by which to access the DB file.
Initializes a new instance of the class.
A stream of the MaxMind DB file.
Initializes a new instance of the class.
A stream of the MaxMind DB file.
List of locale codes to use in name property from most preferred to least preferred.
Returns an for the specified ip address.
The ip address.
An
Returns an for the specified ip address.
The ip address.
An
Look up an IP address in a GeoIP2 Anonymous IP.
The IP address.
An
Returns an for the specified IP address.
The IP address.
An
Returns an for the specified IP address.
The IP address.
An
Returns an for the specified IP address.
The IP address.
An
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
The metadata for the open MaxMind DB file.
This exception is thrown when the IP address is not found in the database.
This generally means that the address was a private or reserved address.
This class represents a generic GeoIP2 error. All other exceptions thrown by
the GeoIP2 API subclass this exception
Initializes a new instance of the class.
A message that describes the error.
Initializes a new instance of the class.
A message that describes the error.
The inner exception.
Initializes a new instance of the class.
A message explaining the cause of the error.
This exception is thrown when there is an authentication error.
Initializes a new instance of the class.
A message explaining the cause of the error.
This class represents an HTTP transport error. This is not an error returned
by the web service itself. As such, it is a IOException instead of a
GeoIP2Exception.
Initializes a new instance of the class.
A message describing the reason why the exception was thrown.
The HTTP status of the response that caused the exception.
The URL queried.
Initializes a new instance of the class.
A message describing the reason why the exception was thrown.
The HTTP status of the response that caused the exception.
The URL queried.
The underlying exception that caused this one.
The HTTP status code returned by the web service.
The URI queried by the web service.
This class represents a non-specific error returned by MaxMind's GeoIP2 web
service. This occurs when the web service is up and responding to requests,
but the request sent was invalid in some way.
Initializes a new instance of the class.
A message explaining the cause of the error.
The error code returned by the web service.
The URL queried.
The error code returned by the web service.
The URI queried by the web service.
This exception is thrown when your account does not have any queries remaining for the called service.
Initializes a new instance of the class.
A message that describes the error.
City-level data associated with an IP address.
Abstract class for records with name maps.
Constructor
Constructor
Returns a that represents this instance.
A that represents this instance.
A from locale codes to the name in that locale.
The GeoName ID for the city.
Gets or sets the locales specified by the user.
The name of the city based on the locales list passed to the
constructor.
Constructor
Constructor
A value from 0-100 indicating MaxMind's confidence that the city
is correct.
Contains data for the continent record associated with an IP address.
Constructor
Constructor
A two character continent code like "NA" (North America) or "OC"
(Oceania).
Contains data for the country record associated with an IP address.
Constructor
Constructor
A value from 0-100 indicating MaxMind's confidence that the country
is correct. This attribute is only available from the Insights web
service end point.
The two-character ISO
3166-1 alpha code for the country.
Contains data about an error that occurred while calling the web service
Gets or sets the error.
The error message returned by the service.
Gets or sets the code.
The error code returned by the service.
Contains data for the location record associated with an IP address.
Constructor
Constructor
Returns a that represents this instance.
A that represents this instance.
The radius in kilometers around the specified location where the
IP address is likely to be. This attribute is only available from
the Insights end point.
The latitude of the location as a floating point number.
The longitude of the location as a floating point number.
The metro code of the location if the location is in the US.
MaxMind returns the same metro codes as the Google AdWords API.
The time zone associated with location, as specified by the IANA Time Zone
Database, e.g., "America/New_York".
Contains data related to your MaxMind account.
Constructor
Constructor
Returns a that represents this instance.
A that represents this instance.
The number of remaining queried in your account for the web
service end point. This will be null when using a local
database.
Contains data for the postal record associated with an IP address.
Constructor
Constructor
Returns a that represents this instance.
A that represents this instance.
The postal code of the location. Postal codes are not available
for all countries. In some countries, this will only contain part
of the postal code.
A value from 0-100 indicating MaxMind's confidence that the
postal code is correct. This attribute is only available from the
Insight web service end point.
Contains data for the represented country associated with an IP address.
This class contains the country-level data associated with an IP address for
the IP's represented country. The represented country is the country
represented by something like a military base.
Constructor
Constructor
A string indicating the type of entity that is representing the
country. Currently we only return military but this could
expand to include other types in the future.
Contains data for the subdivisions associated with an IP address.
Constructor
Constructor
This is a value from 0-100 indicating MaxMind's confidence that
the subdivision is correct. This attribute is only available from
the Insights web service end point.
This is a string up to three characters long contain the
subdivision portion of the code.
Contains data for the traits record associated with an IP address.
Constructor
Constructor
Returns a that represents this instance.
A that represents this instance.
The autonomous system number associated with the IP address.
This attribute is only available from the City and Insights web
service end points.
The organization associated with the registered autonomous system number for the IP address. This attribute
is only available from the City and Insights web service end points.
The second level domain associated with the IP address. This will
be something like "example.com" or "example.co.uk", not
"foo.example.com". This attribute is only available from the
City and Insights web service end points.
The IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the
externally routable IP address for the system the code is running
on. If the system is behind a NAT, this may differ from the IP
address locally assigned to it.
This is true if the IP is an anonymous proxy. See
MaxMind's GeoIP
FAQ
This is true if the IP belong to a satellite internet provider.
The name of the ISP associated with the IP address. This
attribute is only available from the City and Insights web
service end points.
The name of the organization associated with the IP address. This
attribute is only available from the City and Insights web
service end points.
The user type associated with the IP address. This can be one of
the following values:
business
cafe
cellular
college
content_delivery_network
dialup
government
hosting
library
military
residential
router
school
search_engine_spider
traveler
This attribute is only available from the Insights end point.
Abstract class that city-level response.
Abstract class for country-level response.
Abstract class that represents a generic response.
Initializes a new instance of the class.
Initializes a new instance of the class.
Returns a that represents this instance.
A that represents this instance.
Sets the locales on all the NamedEntity properties.
The locales specified by the user.
Gets the continent for the requested IP address.
Gets the country for the requested IP address. This
object represents the country where MaxMind believes
the end user is located
Gets the MaxMind record containing data related to your account
Registered country record for the requested IP address. This
record represents the country where the ISP has registered a
given IP block and may differ from the user's country.
Represented country record for the requested IP address. The
represented country is used for things like military bases or
embassies. It is only present when the represented country
differs from the country.
Gets the traits for the requested IP address.
Initializes a new instance of the class.
Initializes a new instance of the class.
Returns a that represents this instance.
A that represents this instance.
Sets the locales on all the NamedEntity properties.
The locales specified by the user.
Gets the city for the requested IP address.
Gets the location for the requested IP address.
Gets the postal object for the requested IP address.
An of objects representing
the country subdivisions for the requested IP address. The number
and type of subdivisions varies by country, but a subdivision is
typically a state, province, county, etc. Subdivisions are
ordered from most general (largest) to most specific (smallest).
If the response did not contain any subdivisions, this method
returns an empty array.
An object representing the most specific subdivision returned. If
the response did not contain any subdivisions, this method
returns an empty object.
This class provides a model for the data returned by GeoIP2 Precision: City and GeoIP2 City.
The only difference between the City and Insights response classes is
which fields in each record may be populated.
GeoIP2 Web
Services
Constructor
Constructor
This class represents the GeoIP2 Anonymous IP response.
Constructor
Returns true if the IP address belongs to any sort of anonymous network.
Returns true if the IP address belongs to an anonymous VPN system.
Returns true if the IP address belongs to a hosting provider.
Returns true if the IP address belongs to a public proxy.
The IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the
externally routable IP address for the system the code is running
on. If the system is behind a NAT, this may differ from the IP
address locally assigned to it.
This class represents the GeoIP2 ISP response.
Constructor
The autonomous system number associated with the IP address.
The organization associated with the registered autonomous system number for the IP address.
The name of the ISP associated with the IP address.
The name of the organization associated with the IP address.
The IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the
externally routable IP address for the system the code is running
on. If the system is behind a NAT, this may differ from the IP
address locally assigned to it.
This class represents the GeoIP2 Connection-Type response.
Constructor
The connection type of the IP address.
The IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the
externally routable IP address for the system the code is running
on. If the system is behind a NAT, this may differ from the IP
address locally assigned to it.
This class represents the GeoIP2 Domain response.
Constructor
The second level domain associated with the IP address. This will
be something like "example.com" or "example.co.uk", not
"foo.example.com".
The IP address that the data in the model is for. If you
performed a "me" lookup against the web service, this will be the
externally routable IP address for the system the code is running
on. If the system is behind a NAT, this may differ from the IP
address locally assigned to it.
This class provides a model for the data returned by the GeoIP2 Precision: Country and GeoIP2 Country.
The only difference between the City and Insights response classes is
which fields in each record may be populated.
See GeoIP2 Web
Services
Constructor
Constructor
This class provides a model for the data returned by the GeoIP2 Precision:
Insights end point.
The only difference between the City and Insights response classes is
which fields in each record may be populated.
GeoIP2 Web
Services
Constructor
Constructor
This class provides a client API for all the GeoIP2 Precision web service
end points. The end points are Country, City, and Insights. Each end point
returns a different set of data about an IP address, with Country returning
the least data and Insights the most.
Each web service end point is represented by a different model class
which contains data about the IP address.
If the web service does not return a particular piece of data for an IP
address, the associated property is not populated.
The web service may not return any information for an entire record, in which
case all of the properties for that model class will be empty.
Usage
The basic API for this class is the same for all of the web service end
points. First you create a web service object with your MaxMind
userID and licenseKey, then you call the method corresponding
to a specific end point, passing it the IP address you want to look up.
If the request succeeds, the method call will return a model class for the
end point you called. This model in turn contains multiple record classes,
each of which represents part of the data returned by the web service.
If the request fails, the client class throws an exception.
Exceptions
For details on the possible errors returned by the web service itself, see the GeoIP2 web
service documentation.
Initializes a new instance of the class.
Your MaxMind user ID.
Your MaxMind license key.
The base url to use when accessing the service
Timeout in milliseconds for connection to web service. The default is 3000.
Initializes a new instance of the class.
The user unique identifier.
The license key.
List of locale codes to use in name property from most preferred to least preferred.
The base url to use when accessing the service
Timeout in milliseconds for connection to web service. The default is 3000.
Returns an for the specified ip address.
The ip address.
An
Returns an for the specified ip address.
The ip address.
The RestClient to use
An
Returns an for the specified ip address.
The ip address.
An
Returns an for the specified ip address.
The ip address.
The RestClient to use
An
Returns an for the specified ip address.
The ip address.
An
Returns an for the specified ip address.
The ip address.
The RestClient to use
An