简体   繁体   English

如何获取正确的客户端IP地址。 客户端 IP 地址在使用 Javascript RTCPeerConnection 时作为一些随机值出现?

[英]How to get correct client IP address. client IP address coming as some random value while using Javascript RTCPeerConnection?

I am trying to get client IP address using javascript (WebRTC).But,I am getting some anonymous values on a few machines.我正在尝试使用 javascript (WebRTC) 获取客户端 IP 地址。但是,我在几台机器上获得了一些匿名值。 Example:"04e6e16d-5ca8-4643-bccd-f870c84d4aed.local"示例:“04e6e16d-5ca8-4643-bccd-f870c84d4aed.local”

I am not sure, what went wrong and what address it is.我不确定,出了什么问题,地址是什么。 Please guide us.请指导我们。

I am using the code from below source to get an IP address我正在使用来自以下源代码的代码来获取 IP 地址

https://gist.github.com/hectorguo/672844c319547498dcb569df583f959d https://gist.github.com/hectorguo/672844c319547498dcb569df583f959d

WebRTC hosts candidates will now be anonymized using random mDNS hostnames to prevent websites from diverting WebRTC to snoop on local IPv4 addresses. WebRTC 主机候选者现在将使用随机 mDNS 主机名进行匿名化,以防止网站转移 WebRTC 以窥探本地 IPv4 地址。 The behavior is gradually enabled for all Chrome users.该行为会逐渐为所有 Chrome 用户启用。 It's also being implemented in Firefox.它也在 Firefox 中实现。

Here are the corresponding tickets for Chromium and Firefox , and the current IETF draft for WebRTC mDNS candidates.以下是ChromiumFirefox的相应票证,以及 WebRTC mDNS 候选者的当前IETF 草案

For now, during local development you can still revert to the former behavior by setting the flag to disabled at chrome://flags/#enable-webrtc-hide-local-ips-with-mdns目前,在本地开发期间,您仍然可以通过在chrome://flags/#enable-webrtc-hide-local-ips-with-mdns将标志设置为禁用来恢复到以前的行为

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM