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

chrome和firefox关闭webrtc

4年前 (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

相关文章

centos6

centos6

#无论什么时候安装养成良好习惯,更新下源  yum update  #更新会提示你is that OK?(y/n),记得选择y #安装下 wg...

Linux 修改 root 密码

Linux 修改 root 密码

我觉得应该比较通用用root 用户登录之后输入passwd输入两遍密码密码不显示OK...

Windows Server 2012 R2多语言包

Windows Server 2012 R2多语言包

https://soft.shaobing.ru/Windows/%E7%B3%BB%E7%BB%9F%E8%AF%AD%E8%A8%80%E5%8C%85/...

红米AC2100刷Padavan记录

红米AC2100刷Padavan记录

前半段参考:红米AC2100刷openwrt记录刷成breed之后直接在breed后台刷padavan固件,不需要临时固件不过我记得刷openwrt的时候需要填一下小米环境,我没有去掉,也是能用的就是...

华为P20不能升级系统或者P20PRO不能升级10系统的解决办法

华为P20不能升级系统或者P20PRO不能升级10系统的解决办法

碰到的问题是华为P20停留在EMUI8.0.1系统检查更新页面一直检测当前是最新版本这都鸿蒙2系统都有了这很操蛋网上找一圈之后没有解决办法SO瞎折腾之后终于解决方法如下:在系统界面点系统更新,然后会说...

Cachify插件的一些转载

Cachify插件的一些转载

以下来源于:https://www.xiapilu.com/web/web-tutorial/cachify-accelerate-website-wordpress.htmlhttps://www....