从浏览器中的WebSocket获取IP地址 [英] Get IP address from WebSocket in browser

查看:749
本文介绍了从浏览器中的WebSocket获取IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要获取WebSocket的IP地址并将其与其他已连接的WebSocket进行比较,以防止出现冗余连接,因为此应用程序的服务器地址列表是从潜在的恶意源中检索的.

I need to get the IP address of a WebSocket and compare it to other already connected WebSockets to prevent redundant connections because the list of server addresses for this application are retrieved from potentially malicious sources.

我已经检查了WebSocket对象和规范,看起来url可以返回,但不能返回IP.

I've examined the WebSocket object and the specification, and it appears that the url can be returned but not the IP.

如何从浏览器的WebSocket连接中检索IP?

How can the IP be retrieved from the WebSocket connection in a browser?

推荐答案

AFAIK,没有从URL获取解析IP的方法,您可以使用外部服务,请检查

AFAIK, there is no such way to get resolve IP from url, you may use external services, check http://www.fileformat.info/tool/rest/dns-json.htm

这篇关于从浏览器中的WebSocket获取IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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