diff options
| author | Shauren <shauren.trinity@gmail.com> | 2018-06-23 21:31:09 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2019-01-09 17:35:18 +0100 |
| commit | 50cfeb9aa406b9f81a6aa51dcd87201e5f3bae1e (patch) | |
| tree | 5f47b715128418cc91091711f0358e5c2dea961f /src/common/IPLocation/IPLocation.h | |
| parent | 61532e9816f750ae1690f8d5fca92525d6297ab6 (diff) | |
Core/Misc: Improved ip2location code and set it to disabled by default
(cherry picked from commit 0ead73516adfeaff96292685592085e20737d535)
Diffstat (limited to 'src/common/IPLocation/IPLocation.h')
| -rw-r--r-- | src/common/IPLocation/IPLocation.h | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/common/IPLocation/IPLocation.h b/src/common/IPLocation/IPLocation.h index a22aafa2e5d..e322fcc1d4c 100644 --- a/src/common/IPLocation/IPLocation.h +++ b/src/common/IPLocation/IPLocation.h @@ -21,10 +21,14 @@ struct IpLocationRecord { - uint32 ip_from; - uint32 ip_to; - std::string country_code; - std::string country_name; + IpLocationRecord() : IpFrom(0), IpTo(0) { } + IpLocationRecord(uint32 ipFrom, uint32 ipTo, std::string countryCode, std::string countryName) + : IpFrom(ipFrom), IpTo(ipTo), CountryCode(std::move(countryCode)), CountryName(std::move(countryName)) { } + + uint32 IpFrom; + uint32 IpTo; + std::string CountryCode; + std::string CountryName; }; class TC_COMMON_API IpLocationStore @@ -32,13 +36,13 @@ class TC_COMMON_API IpLocationStore public: IpLocationStore(); ~IpLocationStore(); - static IpLocationStore* instance(); + static IpLocationStore* Instance(); void Load(); - IpLocationRecord* GetData(std::string const& ipAddress); + IpLocationRecord const* GetLocationRecord(std::string const& ipAddress) const; private: std::vector<IpLocationRecord> _ipLocationStore; }; -#define sIPLocation IpLocationStore::instance() +#define sIPLocation IpLocationStore::Instance() |
