查找位置的最佳 node.js 模块? [英] Best node.js module for finding location?

查看:28
本文介绍了查找位置的最佳 node.js 模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了几个 node.js 模块,用于使用 ip 查找有关客户端位置和网络的信息地址.

I had found couple of node.js modules for finding the information about client location and network using ip address.

要求:

  1. 位置 - 国家、城市、州、纬度、经度等

  1. Location - country, city, state, latitude, longitude etc.

网络 - 互联网服务提供商、互联网连接类型和互联网速度等

Network - Internet service Provider, Internet connection type and internet speed etc.

数据准确性 - 最大可能性.

Data Accuracy - maximum possibility.

注意:正在寻找服务器端解决方案.

Note: Looking for server side solution.

上述模块使用 maxmind 数据.我也读过 maxmind 数据准确性.

The above mentioned modules uses maxmind data. And i had read about the maxmind data accuracy as well.

我对选择上述 node.js 模块有点困惑,我想知道是否有更好的 node.js 框架可用于查找满足我要求的信息或任何其他可以移植到 node.js 的语言插件.

I am little confused to choose the above node.js modules and i like to know is there any better node.js frameworks available for finding information which met my requirement or any other language plugins which can be portable to node.js.

任何想法都会很棒.

推荐答案

使用基于 IP 的地理位置是可能的,但不是很准确.因此,我建议您考虑采用混合方法,例如尝试通过浏览器内的 HTML5 地理定位 API 获取用户位置,并在必要时回退到服务器端.

Using IP-based geolocation is possible, but not very accurate. So I suggest you to think about going with a hybrid approach, like trying to get the users location via the HTML5 geolocation API inside the browser and fallback to the serverside if necessary.

我查看了可用于 node.js 的两个最常用的 geoip/-location 模块,它们都使用 MaxMind 提供的数据集.AFAIK 您必须手动使这些数据库保持最新状态,这显然令人沮丧.所以你可以考虑写一个同步服务/脚本,每月更新一次数据库.(有关 MaxMinds 免费解决方案的更多信息,请参见此处).

I took a look at the two most used geoip/-location modules available for node.js and they both use the datasets provided by MaxMind. AFAIK you have to keep these databases up-2-date manually, which is a clear downer. So you may consider writing a little sync service / script, which updates the database once per month. (More information on MaxMinds free solution can be found here).

kuno/GeoIP 是一个 GeoIP 绑定,所以它的核心是使用 libGeoIP C 库,这没问题,但可能不如纯 JavaScript 实现那样可移植 bluesmoon/node-geoip 提供.两者都可以,取决于您更喜欢哪个库.在性能方面,你必须做一些基准测试(如果这个主题对你很重要)......这个问题没有一般的答案,哪种类型的模块(C 绑定/本机)会更快.

kuno/GeoIP is a GeoIP binding, so at it's core it's using the libGeoIP C library, which is okay, but maybe not as portable as the pure JavaScript implementation bluesmoon/node-geoip offers. Both are okay and it's up to you which library you like more. In terms of performance you have to do some benchmakrs (if this topic matters to you) … There is no general answer to the question, which type of module (C-binding/native) will be faster.

如果你愿意花几块钱,你也可以看看 MaxMinds Web Service,这是一个简单的 REST API,将是最精确的方法.文档非常好,因此入门不会有问题.

If you're willing to spend a few bucks you could also look into MaxMinds Web Service, which is a simple REST API and will be the most precise way to go. The documentation is quite good – so getting started with that won't be a problem.

这篇关于查找位置的最佳 node.js 模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆