Thread: IpToCountry
View Single Post
  #1  
Unread 19th May, 2010, 05:16 PM
Matthew Matthew is offline
Holy Shit!!
 
Join Date: Dec 2004
Posts: 2,382
Default IpToCountry

IpToCountry 1.6 for Unreal Tournament '99

Initial to v1.2 by [es]Rush
v1.6 by Matthew 'MSuLL' Sullivan

Release Date: May 21, 2010
Distributed under the terms of OpenUnrealMod license - see LICENSE.txt for details


>> Download Here <<
(also mirrored at UT-Files)

IF UPGRADING (IMPORTANT!)
-------
If you are upgrading from an old version, please see the section 'UPGRADING'
in the readme file. There have been a few important changes you need to be aware of!


CHANGELOG
-------
1.6: -Workaround to prevent crashing, improve stability and efficiency.
-Trying to switch between query servers no longer fails
-Re-added DNS resolution. IP cached in the config, if it changes the mod will re-resolve.
-Increased number of query servers to 4.


1.2: -Added a small clientside package to identify AOL's country. Will work for USA/GB/DE players.
-Added ErrorLimit variable.
-Removed dependency on the DNS resolving system in UnrealEngine which seemed to be crashing the servers.
Now all host based query servers have to specify an IP.

1.1: -Fixed the texture package, now it is CountryFlags2, this one should be perfect.
-Fixed accessed nones in the Addon part while playing on the server with bots.

1.0: -First version

SPECIAL NOTE
-------
Starting at version 1.6, I (MSuLL) will be trying to support this mod through updates and bugfixes, as Rush
has since moved on from UT and Unreal coding. Rush created the initial versions and did an excellent job.
Most of us (coders) didn't even know such magic was possible until this mod was created and refined.
To both Rush and AnthraX: thank you so very much for your contributions to this mod, and to the UT
community in general. We, the players and admins of UT, deeply appreciate it and thank you for your efforts!

WHAT IS IT FOR?
-------
In short, as the name says, it can resolve a country from an IP address; it also resolves a hostname.
IpToCountry is meant mainly to be just a shared component between many other mods, for example
recent versions of SmartCTF, etc. Don't expect much black magic from IpToCountry itself. But to not
make you sad I've also made a little addon which will show players' country names after doing a
mutate command, for admins there is a similiar command showing hostnames, this addon is enabled by
default, but you can disable it in the config.

HOW DOES IT WORK?
-------
To your knowledge, resolving a country from an IP requires quite a big database and implementing
it in UnrealScript would be very hard, thus IpToCountry connects to a PHP script which is located
on a web server. This PHP script uses a database kindly distributed by www.maxmind.com
If you want to know how the querying stuff exactly works just "Use the source Luke!"

AOL is quite troublesome. AOL has all its IP ranges registered in the USA and thus it doesn't
make identification easy. Fortunately Rush found a way to go around the problem.
Three major countries where AOL is very popular are: USA, Great Britain and Germany. All those three have
different timezones, so Rush just had to get a player's time and compare it to GMT. The idea maybe was Rush's
but Cratos was the first to implement it in LeagueAS, Rush got some code from him so big thanks, mate.

WHO USES IT?
-------
At the time of writing this readme the following mods/mutators make use of IpToCountry (that I know of...):
-SuperWebAdmin 0.97
-LeagueAS140
-SmartCTF_4D (and up)
-BTPlusPlusv097
-Hostname Ban
-Nexgen

A NOTE ON THE HTTPCLIENT CLASS (FOR DEVS ONLY)
-------
UT's implementation of a strong, stable HTTP Client wasn't much of a success. Thankfully Rush and
AnthraX took some time and made great progress on a UScript-based solution for the original
builds of IpToCountry. Problem is: if both query servers went down, or the internet stopped working for
just a little while, the entire UT server process would often die. In September 2008 I
(MSuLL) began working on a mod that would depend on strong HTTP communications, which became the mod
'Universal Unreal'. I used Rush's IpToCountry HTTP Client implentation as a base, then went about refining
it and making it more stable and efficient.

One big issue with the old client was that everything was being performed from the HTTP Client class,
and that class was spawned as a ServerActor at startup. When something screws up, the HTTP Client class,
which is based off of UBrowserHTTPClient, can't re-bind a port properly. The solution is to kill the
HTTP Client class and start another instance upon a critical bind error.

For v1.6(+future editions) of IpToCountry, I've ported (or un-ported?) my HTTP Client implementation
back into the mod where it all began. I've separated it into three main parts. The LinkActor class
does error handling and general data management. The HTTPClient class does the grunt work and can be
killed off (and then restarted) when critical errors are encountered. The third class is the Addon
class, nothing major has changed in this class though.

I'd encourage developers to make use of this improved HTTP Client implementation in your own
mods. Even though this game is 11 years old, there's still time for cool new stuff to be built
The class is very modular and shouldn't be too hard to understand / modify / etc. Feel free to
ask for help in the UnrealAdmin.org forum, and I'd be glad to help.

THANKS TO
-------
AnthraX - for overall help, consultations and helping UT'99 community so much, thanks mate! Also thanks for updating the query server
teleport*bR - thanks for the great help in putting the texture package to one, thanks also for testing
Cratos - for supporting IpToCountry in LeagueAS and giving me some code to identify AOL's timezone
UnrealAdmin - for keeping UT alive
Attached Files
File Type: zip IpToCountry-1.0.zip (696.6 KB, 21 views)
File Type: zip IpToCountry-1.1.zip (92.2 KB, 18 views)
File Type: zip IpToCountry-1.2.zip (103.5 KB, 18 views)
File Type: zip IpToCountry-1.2-v2.zip (749.3 KB, 18 views)
File Type: zip IpToCountry-1.2-v3.zip (716.6 KB, 23 views)
File Type: zip ipToCountry-1.6.zip (623.1 KB, 243 views)

Last edited by Matthew : 12th December, 2013 at 08:35 PM.
Reply With Quote