使用 COMET 服务器实现假设恒定 IP 地址是否安全?
我们的网站使用内部实现的长轮询 COMET 服务器与客户端计算机上的网页进行通信。 Connection
对象管理单个客户端的请求和响应。 Connection
对象可以存在多个小时并处理来自同一客户端的数百个请求,同时它们仍保持与服务器的“连接”。
我的问题是:可以安全地假设单个客户端在单个会话中发出的请求的原始地址将保持不变吗?我想制定规则来强制执行此操作,以便如果客户端源自新的 ipAddress,则它们需要从头开始。我想知道是否存在一种常见情况,即来自单个浏览器的请求可能源自不同的 ip 地址,其速率会使我的计划变得愚蠢。
Our website uses an in-house implemented long-polling COMET server to communicate with the web-page on the client machine. A Connection
object manages the requests and responses for a single client. The Connection
object can live for many hours and deal with several hundred requests from the same client, while they remain "connected" to the server.
My question is: Is it safe to assume that the originating address of requests from a single client over a single session will remain constant? I'd like to make rules to enforce this such that if the client originates from a new ipAddress, they need to start from scratch. I am wondering if there is a common case where requests from a single browser might originate from different ipAddresses at a rate that would make my plan stupid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这将取决于所讨论的网络以及您实际尝试检测的用户行为。
许多用户都位于网络地址转换器 (NAT) 和/或网络代理后面,因此您无论如何都看不到他们的“真实”或“本地”IP 地址,例如,如果您使用的是典型的家庭宽带网络,请查询您的本地 IP计算机上的地址(例如,如果您在 MAC 上使用 Windows 或网络实用程序,则使用 ipconfig)并将其与另一个网络中的服务器在您联系时看到的 IP 地址进行比较(例如,使用类似 http://whatismyipaddress.com/)。互联网中的服务器将看到与您在本地看到的不同的地址。
因此,您可能有一个用户属于大型网络的一部分,该网络仅使用一个或两个外部 IP 地址与外部网络进行通信,并且该用户可能会从一个本地网络连接“拔出”并“插入”另一个本地网络连接,从而获得新的本地 IP 地址,但您看不到它,因为连接仍然通过大型网络外部 IP 地址进行。
I think that it will depend on the networks in question and also on what user behavior you are actually trying to detect.
Many users are behind network address translators (NATs) and/or network proxies so you will not be seeing their 'real' or 'local' IP address anyway, For example, if you are on a typical home broadband network, query your local IP address on your machine (e.g. using ipconfig if you are using windows or network utility on a MAC) and compare it to the IP address that a server in another network sees when you contact it (e.g. using a site like http://whatismyipaddress.com/). The server in the internet will see a different address than you are seeing locally.
So you may have a user who is part of a large network that uses only one or two IP addresses externally to communicate with the external web and the user may 'unplug' from one local network connection and 'plug into' another one, getting a new local IP address, but it would be invisible to you as the connections would still come via the large networks external IP address.