Resource icon

GeoIP 2.2.2

No permission to download
Fougerite Compatibility
All Versions
Plugin's Engine
C# (Modules)
Description:

This plugin is able to provide local information of the given IP address on a local database, making It safer/faster for anyone.

Server owners just have to install this plugin as a C# plugin only.

Plugin Devs:

Python Example:


Python:
__author__ = 'DreTaX'
__version__ = '1.0'

import clr
clr.AddReferenceByPartialName("Fougerite")
import Fougerite

try:
    clr.AddReferenceByPartialName("GeoIP")
    import GeoIP
    from GeoIP import GeoIP as RealGeoIP
except:
    raise ImportError("Failed to reference the GeoIP.dll")

geo = RealGeoIP.Instance


class Test2:

    def On_PluginInit(self):
        IPData = geo.GetDataOfIP("0.0.0.0")
        if IPData is None:
            Server.Broadcast("FAILED")
            return
        Plugin.Log("Data", IPData.Country)
Python:
__author__ = 'DreTaX'
__version__ = '1.0'

import clr
clr.AddReferenceByPartialName("Fougerite")
import Fougerite

try:
    clr.AddReferenceByPartialName("GeoIP")
    import GeoIP
    from GeoIP import GeoIP as RealGeoIP
except:
    raise ImportError("Failed to reference the GeoIP.dll")

geo = RealGeoIP.Instance

class Test2:

    def On_PluginInit(self):
        # We pass the IP, the callback function, and optionally the Player object
        # Since this is PluginInit, we pass None for player.
        geo.GetDataOfIP("8.8.8.8", self.GeoIPCallback, None)
        Server.Broadcast("GeoIP Request Sent (Non-Blocking)...")

    def GeoIPCallback(self, ip_data, player):
        """
        This is the callback function.
        ip_data is the IPData object (or None)
        player is the Fougerite.Player object we passed (or None)
        """
        if ip_data is None:
            # Handle local IP or failed lookup
            Fougerite.Logger.LogDebug("[GeoIP] Lookup failed or IP is local.")
            return

        # Access data
        country = ip_data.Country
        city = ip_data.City
       
        Fougerite.Logger.LogDebug("[GeoIP] Result: " + str(country) + " - " + str(city))
       
        # If we had passed a player, we could use them here:
        if player is not None:
            player.Message("Your IP is from: " + country)

    def On_PlayerConnected(self, player):
        # Example of using it when a player joins
        geo.GetDataOfIP(player.IP, self.GeoIPCallback, player)

JavaScript:

Soon...

Lua:

Soon...

API:

Methods:
C#:
GetDataOfIP(string ip):IPData
Variables:
IPData class
C#:
Instance:GeoIP[/INDENT][/INDENT]
[INDENT][INDENT]// IPData Class Variables, returned by GetDataOfIp[/INDENT][/INDENT]
[INDENT][INDENT]CityData:GCityData[/INDENT][/INDENT]
[INDENT][INDENT]IPRange:string[/INDENT][/INDENT]
[INDENT][INDENT]CountryCode:string[/INDENT][/INDENT]
[INDENT][INDENT]RegisteredCountryCode:string[/INDENT][/INDENT]
[INDENT][INDENT]IsAnonymousProxy:bool[/INDENT][/INDENT]
[INDENT][INDENT]IsSatelliteProvider:bool[/INDENT][/INDENT]
[INDENT][INDENT]IPLocationData:IPLocationData // It stores the country and continents below, It's just there, no need to use It.[/INDENT][/INDENT]
[INDENT][INDENT]Country:string[/INDENT][/INDENT]
[INDENT][INDENT]CountryShort:string[/INDENT][/INDENT]
[INDENT][INDENT]Continent:string[/INDENT][/INDENT]
[INDENT][INDENT]ContinentShort:string[/INDENT][/INDENT]
[INDENT][INDENT]StoredIP:string // Gives back the IP you are checking
GCityData class
C#:
GeoID:string[/INDENT][/INDENT]
[INDENT][INDENT]CountryGeoID:string[/INDENT][/INDENT]
[INDENT][INDENT]AnonymousProxy:bool[/INDENT][/INDENT]
[INDENT][INDENT]SatelliteProvider:bool[/INDENT][/INDENT]
[INDENT][INDENT]Latitude:string[/INDENT][/INDENT]
[INDENT][INDENT]Longitude:string[/INDENT][/INDENT]
[INDENT][INDENT]Country:string[/INDENT][/INDENT]
[INDENT][INDENT]CountryShort:string[/INDENT][/INDENT]
[INDENT][INDENT]Continent:string[/INDENT][/INDENT]
[INDENT][INDENT]ContinentShort:string
Author
DreTaX
Downloads
277
Views
2K
First release
Last update
Rating
5.00 star(s) 2 ratings

More resources from DreTaX

Latest updates

  1. 2.2.2

    Some code fixes. Added non blocking api Fixed download link and pushed it to github Database is...
  2. 2.2

    Wrong link, same update.
  3. 2.2

    I forgot to update GeoIP after the website problem before. Here is the newest one with threaded...

Latest reviews

Excellent Database! Saves doing web requests!
DreTaX
DreTaX
Thanks!
Amazing.. :)
DreTaX
DreTaX
Thanks!