Raised This Month: $51 Target: $400
 12% 

Assistance with ip/geocity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ozrich
AlliedModders Donor
Join Date: Oct 2015
Old 03-16-2019 , 05:28   Assistance with ip/geocity
Reply With Quote #1

Hi Guys,

I'm using the Connect Announce (cannounce) plugin here https://forums.alliedmods.net/showthread.php?t=77306

From what I can see (I'm new to sourcemod coding) it uses geoipcity and geoip. It also utililses the function below, which I believe is the main part.

I've also attached the full code here https://pastebin.com/6DePkiuL

For at least one person in my server, it shows they're from UK but is actually in Australia. They're not using a VPN. Any help would be appreciated!

PHP Code:
bool:IsLanIPString:src[16] )
{
    
decl String:ip4[4][4];
    new 
ipnum;

    if(
ExplodeString(src"."ip444) == 4)
    {
        
ipnum StringToInt(ip4[0])*65536 StringToInt(ip4[1])*256 StringToInt(ip4[2]);
        
        if((
ipnum >= 655360 && ipnum 655360+65535) || (ipnum >= 11276288 && ipnum 11276288+4095) || (ipnum >= 12625920 && ipnum 12625920+255))
        {
            return 
true;
        }
    }

    return 
false;

__________________
ozrich is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 03-16-2019 , 08:56   Re: Assistance with ip/geocity
Reply With Quote #2

Quote:
Originally Posted by ozrich View Post
For at least one person in my server, it shows they're from UK but is actually in Australia. They're not using a VPN. Any help would be appreciated!
MaxMind, who are very kind to provide a free "Lite" database has recently discontinued the format with the typical "GeoIP.dat" file, so as per January 2, 2019 you will no longer see any updates in the GeoIP database there, read more here.

An issue (GeoIP Legacy Discontinuation), as well as a pull request (Add support for Maxmind GeoIP2 database files) already exist, which will hopefully make SourceMod support the newer GeoIP2 format in the future.

The incorrect entries are more likely to be due to an old and non-up-to-date GeoIP.dat file, and not necessarily related to plugin itself nor the IsLanIP function or any other functions in the plugin.

I am afraid you will have to wait until those things are merged, and then once it's done, update your SourceMod.


And exactly as you mentioned with your example, you should also notice that there are no guarantee for accurate results with GeoIP:

According to MaxMind's own tests, their GeoIP2 accuracy for Australia 15%, and for United Kingdom 58% accuracy in regards to mapping an IP address to an exact city. You will never find anything that is 100% accurate.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
ozrich
AlliedModders Donor
Join Date: Oct 2015
Old 03-16-2019 , 09:57   Re: Assistance with ip/geocity
Reply With Quote #3

DarkDevil, thank you very much! So much useful info.

I might see if I can try the plugin with geolite2 possibly with ASN or just ignore it. It's so minimal it's hardly worth it. In the end, if big issue I could always remove the Country.

This helps once again, thank you very much!
__________________
ozrich is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode