如何在 Meteor 中访问客户端 IP 地址? [英] How to access client IP address in Meteor?

查看:27
本文介绍了如何在 Meteor 中访问客户端 IP 地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一个非常基本的问题,没有优雅的解决方案/答案.

This seems like a very basic question that doesn't have an elegant solution/answer out there.

如何从 (1) 服务器或 (2) 客户端访问客户端(远程)IP 地址?

How can I access the client (remote) IP address from (1) the server or (2) the client?

推荐答案

正如 Florin 所提到的,现在这一切都与 Meteor 几乎集成在一起,而不是我们不得不自己做的黑暗时代.但是,我另外将它包装在一个跟踪所有打开连接的包中,并允许您查询它们的 IP:https://github.com/mizzao/meteor-user-status.它还可以做很多其他有用的事情.

As Florin mentioned, this is all pretty much integrated with Meteor now, as opposed to the dark ages when we had to do it ourselves. However, I've additionally wrapped it in a package that tracks all open connections and allows you to query for their IPs: https://github.com/mizzao/meteor-user-status. It also does a bunch of other useful stuff.

这篇关于如何在 Meteor 中访问客户端 IP 地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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