当前位置:首页 >记录 > 正文内容

chrome和firefox关闭webrtc

5年前 (2021-09-02)记录

Firefox可在浏览器上输入:about:config。之后搜索:media.peerconnection.enabled。找到它后双击,将其改成 false 即可。

chrome在webstory搜索webrtc





原理可以参考一下这里: https://github.com/diafygi/webrtc-ips

或者直接把下面这段代码放在chrome的console里运行一下,就知道自己的真实IP了。

//get the IP addresses associated with an account 
function getIPs(callback){ 
var ip_dups = {};
//compatibility for firefox and chrome 
var RTCPeerConnection = window.RTCPeerConnection 
|| window.mozRTCPeerConnection 
|| window.webkitRTCPeerConnection; 
var mediaConstraints = { 
optional: [{RtpDataChannels: true}] 
};
//firefox already has a default stun server in about:config 
// media.peerconnection.default_iceservers = 
// [{"url": "stun:stun.services.mozilla.com"}] 
var servers = undefined;
//add same stun server for chrome 
if(window.webkitRTCPeerConnection) 
servers = {iceServers: [{urls: "stun:stun.services.mozilla.com"}]};
//construct a new RTCPeerConnection 
var pc = new RTCPeerConnection(servers, mediaConstraints);
//listen for candidate events 
pc.onicecandidate = function(ice){
//skip non-candidate events 
if(ice.candidate){
//match just the IP address 
var ip_regex = /([0-9]{1,3}(\.[0-9]{1,3}){3})/ 
var ip_addr = ip_regex.exec(ice.candidate.candidate)[1];
//remove duplicates 
if(ip_dups[ip_addr] === undefined) 
callback(ip_addr);
ip_dups[ip_addr] = true; 
} 
};
//create a bogus data channel 
pc.createDataChannel("");
//create an offer sdp 
pc.createOffer(function(result){
//trigger the stun server request 
pc.setLocalDescription(result, function(){}, function(){});
}, function(){}); 
}
//Test: Print the IP addresses into the console 
getIPs(function(ip){console.log(ip);});





参考:https://www.cnblogs.com/xuan52rock/p/11249083.html

相关文章

一个很好用的浏览器指纹检测网站

一个很好用的浏览器指纹检测网站

https://panopticlick.eff.org/...

Linux系统安装wget命令

Linux系统安装wget命令

参考:https://blog.csdn.net/csdn_heliu/article/details/90052647debian 或者 ubuntu : sudo apt-get install...

WIN2012设置定时重启

WIN2012设置定时重启

开始菜单,找到“计划任务程序”;2 如果无法创建基本任务的话,可能是系统中的“Task Scheduler”服务没有启动,你可在运行中键入“services.msc”,查看“Task Schedule...

Microsoft Edge安装包官网下载链接(支持Windows、安卓、苹果)

Microsoft Edge安装包官网下载链接(支持Windows、安卓、苹果)

链接:https://www.microsoftedgeinsider.com/en-us/download其他版本可以在下面选择...

给 Ubuntu18.04 LTS 安装远程桌面记录

给 Ubuntu18.04 LTS 安装远程桌面记录

简单总结一下对了,我用的是Ubuntu 18.04 LTS 64Bit#更新 sudo apt update #安装桌面环境(X11 Xfce )...

关于修罗论坛xiuno bbs后台插件进不去的解决方案

关于修罗论坛xiuno bbs后台插件进不去的解决方案

在2020/7/6,PHP开源论坛 Xiuno BBS 宣布关闭,访问该网站显示:“国内什么时候有真正的开源环境了再见!”。据悉,Xiuno BBS 是一款国产、小巧、稳定、支持在大数据量下仍然保持高...