fast-geoip | memory replacement for geoip-lite , a node library

 by   onramper Python Version: Current License: MIT

kandi X-RAY | fast-geoip Summary

kandi X-RAY | fast-geoip Summary

fast-geoip is a Python library. fast-geoip has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. However fast-geoip build file is not available. You can download it from GitHub.

This library provides an interface to efficiently query MaxMind's GeoLite databases, which contain geolocation information for IPs. Concretely, this was created as an alternative to geoip-lite that adapts better to use-cases where either a low memory footprint is needed, not many IPs will be examined through the library or a high start-up overhead is unacceptable. Concretely, what geoip-lite does is that, on startup, it reads the whole database from disk, parses it and puts it all on memory, thus this results in the startup time being increased by about ~233 ms along with an increase of memory being used by the process of around ~110 MB, in exchange for any new queries being resolved with low sub-millisecond latencies (~0.02 ms). This works if you have a long-running process that will need to geolocate a lot of IPs and don't care about the increases in memory usage nor startup time, but if, for example, your use-case requires only geolocating a single IP, these trade-offs don't make much sense as only a small part of the satabase is needed to answer that query, not all of it. This library tries to provide a solution for these use-cases by separating the database into chunks and building an indexing tree around them, so that IP lookups only have to read the parts of the database that are needed for the query at hand. This results in the first query taking around 9ms and subsequent ones that hit the disk cache taking 0.7 ms, while memory consumption is kept at around 0.7MB. Wrapping it up, geoip-lite has huge overhead costs but sub-millisecond queries whereas this library doesn't have any overhead costs but its queries are slower (0.7-9 ms). And, without further addo, here's a code snippet of library usage (note that this library uses promises instead of synchronous functions, this is the only difference between this library and geoip-lite). Finally, to add some historical context, this library was originally built with the idea of using it for a lambda container that had to geolocate the IP of the current request, something that turned out to be impossible to do with geoip-lite because memory consumption exceeded the 126MB limit and it slowed down the lambda function by over 200ms just to query a single IP.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              fast-geoip has a low active ecosystem.
              It has 92 star(s) with 8 fork(s). There are 5 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 1 open issues and 1 have been closed. On average issues are closed in 4 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of fast-geoip is current.

            kandi-Quality Quality

              fast-geoip has 0 bugs and 30 code smells.

            kandi-Security Security

              fast-geoip has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              fast-geoip code analysis shows 0 unresolved vulnerabilities.
              There are 8 security hotspots that need review.

            kandi-License License

              fast-geoip is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              fast-geoip releases are not available. You will need to build from source code and install.
              fast-geoip has no build file. You will be need to create the build yourself to build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              It has 225 lines of code, 27 functions and 7 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed fast-geoip and discovered the below as its top functions. This is intended to give you an instant insight into fast-geoip implemented functionality, and help decide if they suit your requirements.
            • Generate a location file
            • Extract location attributes
            • Store content in data directory
            • Parse a number
            • Jsonify an object
            • Generate list of blocks for blocks of blocks
            • Extract block attributes
            • Store the first IP address into the index
            • Convert an IP address to an integer
            • Generate index
            • Remove old data files
            • Store dynamic params
            • Delete a directory
            Get all kandi verified functions for this library.

            fast-geoip Key Features

            No Key Features are available at this moment for fast-geoip.

            fast-geoip Examples and Code Snippets

            No Code Snippets are available at this moment for fast-geoip.

            Community Discussions

            QUESTION

            mysql external shell command to get GeoIP Information from an IP address
            Asked 2018-Jan-02 at 20:35

            I have geoiplookup installed on Centos 7 and I'd like to select an IP from a mysql table and then get the location of an IP address from the command line.

            For example, I can type ! geoiplookup' 123.45.36.35 in mysql and get the city, country, etc.

            I could download the data from MaxMind and then upload it to mysql and run a query as mentioned on this site or this site but I do not want to maintain and update another table monthly. Is this the best solution?

            This link shows several python examples that I have used in fail2ban logs.

            Id like to do something like this:

            ...

            ANSWER

            Answered 2018-Jan-02 at 20:35

            As you mention, if you want to use the geoiplookup utility and keep up-to-date IP info you would need to periodically (monthly), download and maintain the IP updates from MaxMind (with a cron job).

            What you may want to do instead is to call the curl utility, and retrieve data from the super cool ipinfo.io website:

            Source https://stackoverflow.com/questions/48066365

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install fast-geoip

            You can download it from GitHub.
            You can use fast-geoip like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/onramper/fast-geoip.git

          • CLI

            gh repo clone onramper/fast-geoip

          • sshUrl

            git@github.com:onramper/fast-geoip.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link