Vidalia 0.2.12
|
#include <GeoIpResolver.h>
Public Member Functions | |
GeoIpResolver (QObject *parent=0) | |
bool | setLocalDatabase (const QString &databaseFile) |
void | setUseLocalDatabase (bool useLocalDatabase) |
GeoIpRecord | resolve (const QHostAddress &ip) |
Protected Member Functions | |
GeoIpRecord | resolveUsingTor (const QHostAddress &ip) |
GeoIpRecord | resolveUsingLocalDatabase (const QHostAddress &ip) |
Private Attributes | |
bool | _useLocalDatabase |
Definition at line 35 of file GeoIpResolver.h.
GeoIpResolver::GeoIpResolver | ( | QObject * | parent = 0 | ) |
Default constructor.
Definition at line 23 of file GeoIpResolver.cpp.
GeoIpRecord GeoIpResolver::resolve | ( | const QHostAddress & | ip | ) |
Resolves a single IP to a geographic location and returns the result on success. On failure, this returns a default-constructed GeoIpRecord object.
Resolves a single IP to a geographic location.
Definition at line 78 of file GeoIpResolver.cpp.
References _useLocalDatabase, resolveUsingLocalDatabase(), and resolveUsingTor().
Referenced by NetViewer::addRouter().
GeoIpRecord GeoIpResolver::resolveUsingLocalDatabase | ( | const QHostAddress & | ip | ) | [protected] |
Maps ip to an approximate geographic location using a local GeoIP database and returns the result on success.
Definition at line 58 of file GeoIpResolver.cpp.
References GeoIpDatabase::CityDatabase, CountryInfo::countryLocation(), and CountryInfo::countryName().
Referenced by resolve().
GeoIpRecord GeoIpResolver::resolveUsingTor | ( | const QHostAddress & | ip | ) | [protected] |
Maps ip to a country code using Tor, and then maps the country code to a geographic location using the built-in country-to-coordinate database.
Definition at line 45 of file GeoIpResolver.cpp.
References CountryInfo::countryLocation(), CountryInfo::countryName(), TorControl::ipToCountry(), and Vidalia::torControl().
Referenced by resolve().
bool GeoIpResolver::setLocalDatabase | ( | const QString & | databaseFile | ) |
Sets the local database file to databaseFile. Returns true if databaseFile could be opened for reading. Otherwise, returns false.
Definition at line 29 of file GeoIpResolver.cpp.
Referenced by NetViewer::setupGeoIpResolver().
void GeoIpResolver::setUseLocalDatabase | ( | bool | useLocalDatabase | ) |
Enables or disables the use of a local GeoIP database, depending on the value of useLocalDatabase.
Definition at line 39 of file GeoIpResolver.cpp.
References _useLocalDatabase.
Referenced by NetViewer::setupGeoIpResolver().
bool GeoIpResolver::_useLocalDatabase [private] |
Definition at line 84 of file GeoIpResolver.h.
Referenced by resolve(), and setUseLocalDatabase().