node-geoip | Native NodeJS implementation of MaxMind's GeoIP API -- works in node 0.6.3 and above, ask me about o | Runtime Evironment library

 by   geoip-lite JavaScript Version: v1.4.7 License: Non-SPDX

kandi X-RAY | node-geoip Summary

kandi X-RAY | node-geoip Summary

node-geoip is a JavaScript library typically used in Server, Runtime Evironment applications. node-geoip has no bugs, it has no vulnerabilities and it has medium support. However node-geoip has a Non-SPDX License. You can install using 'npm i geoip-lite-zh' or download it from GitHub, npm.

MaxMind provides a set of data files for IP to Geo mapping along with opensource libraries to parse and lookup these data files. One would typically write a wrapper around their C API to get access to this data in other languages (like JavaScript). GeoIP-lite instead attempts to be a fully native JavaScript library. A converter script converts the CSV files from MaxMind into an internal binary format (note that this is different from the binary data format provided by MaxMind). The geoip module uses this binary file to lookup IP addresses and return the country, region and city that it maps to. Both IPv4 and IPv6 addresses are supported, however since the GeoLite IPv6 database does not currently contain any city or region information, city, region and postal code lookups are only supported for IPv4.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              node-geoip has a medium active ecosystem.
              It has 2184 star(s) with 359 fork(s). There are 43 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 21 open issues and 141 have been closed. On average issues are closed in 115 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of node-geoip is v1.4.7

            kandi-Quality Quality

              node-geoip has 0 bugs and 0 code smells.

            kandi-Security Security

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

            kandi-License License

              node-geoip has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              node-geoip releases are not available. You will need to build from source code and install.
              Deployable package is available in npm.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of node-geoip
            Get all kandi verified functions for this library.

            node-geoip Key Features

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

            node-geoip Examples and Code Snippets

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

            Community Discussions

            QUESTION

            Deploying my front end and detecting client location by IP address - which AWS service should handle this? Confused by my options
            Asked 2017-Feb-12 at 13:54

            I'm still new to AWS and just following the documentation and asking questions here when I get stuck. Please excuse me if this question sounds really noobish.

            So far, I've deployed the following:

            1. EB to deploy my REST API

            2. RDS to deploy my psql database

            3. Lambda functions to handle things like authentication & sending JWTs, uploading images to S3, etc.

            I have got my basic back end (no caching (just started learning about redis), etc. set up yet, just the bare bones so far) deployed.

            I'm still developing my front end, and have not even thought about how I will be deploying it yet (probably another deployment on EB, since I am using universal react). I am just developing it locally but using my production env variables now so I am hitting my deployed API, etc.

            One of the MAJOR things I have no idea on how to do is detecting incoming requests from client side to get the client's location by IP address. This is so that I can return the INITIAL results in your general location just like yelp, foursquare, etc. do when you go to to their sites.

            For now, I am just building a web app on desktop so I just want to worry about getting the IP address to get the general area of the user. My use case is something similar to other sites you might have used which provides an INITIAL result set for things in your area (think foursquare or yelp).

            Here are my questions:

            1. What would be a good way to do this? I'm thinking of handling this in my front end react universal deployment since it will be a node server with rendered page caching. Is this a terrible idea? It would work something like

              (1) request from client comes in

              (2) get IP from request and lookup the IP location using some service (still not sure what I'm going to use, have found a few plus a nodejs library called node-geoip). Preferably, I can get the zip code since I am trying to save having to do so many queries by unique locations in my database, and instead return results in the zip code and the front end will show an initial map with the initial results in that zip code.

              (3) return to client the rendered page with those location params if it exists, otherwise create it, send it, and cache it.

            2. Is the above a really dumb idea? Maybe you have already done something like this, and could share your wisdom :)

            3. Is there an AWS service which can already handle something like this for me? Perhaps there's some functionality which can already do this.

            Thanks.

            AGAIN - I apologize if this is long winded. I don't know anyone in real life who can help me and I feel alone :(. I appreciate the help you guys can provide.

            ...

            ANSWER

            Answered 2017-Feb-12 at 13:54

            There are two parts to this:

            1. Getting the user's IP address. You mentioned you're using 'EB' - I presume you mean AWS ELB (Elastic Load Balancer)? If so, then you need to read the X-Forwarded-For HTTP header in your app code, since otherwise what you'll really detect is the ELB's IP address. X-Forwarded-For contains the user's real IP - or rather, the IP of the end-connection being made (there's no telling if this is really a VPN, Proxy or something else-- but it's as far as you can get with an IP.)

            2. Querying an IP DB that can turn the addr into a location object. There are tons of libraries for you. Assuming you're using Node, you can use node-geoip as you mentioned. Or you can just search 'geoip service' on Google and find managed services, like Telize on Mashape. If you don't want to manage the DB lookup yourself or keep the thing up to date, then a managed service would help.

            In either case, it's likely that you'll be doing asynchronous look-ups. In that case, you might want to use async/await to get the user's full object before injecting that into your React props and ultimately rendering it as a HTML string that's sent down to the client.

            You could also use a library like redial to decorate your components with data requirements, and return a Promise you can await on to know when you're okay to render.

            Since you probably want to enable client routing too (i.e. where the user can click on a route in their browser, and the server isn't touched at all), then you will probably need some way to retrieve the IP address/results based on that IP even when the server isn't involved in the initial render.

            For that, you could write a REST service that retrieves the results. Or write a GraphQL back-end that gets the data. It doesn't matter how you write it, since the server will have access to the X-Forwarded-For header and can use that to retrieve the results and send back location-aware data.

            FYI, I'm writing a React starter kit (called ReactNow) that uses rxjs for handling async streams. It's not ready yet, but it might help you figure out the code layout that would offer a balanced mix between rendering on the server, and writing universal code that requires some heavy lifting from the server.

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install node-geoip

            You can install using 'npm i geoip-lite-zh' or download it from GitHub, npm.

            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/geoip-lite/node-geoip.git

          • CLI

            gh repo clone geoip-lite/node-geoip

          • sshUrl

            git@github.com:geoip-lite/node-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