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

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

相关文章

tp-link路由器设置远程访问内网的多台电脑并开启远程桌面,遇到的坑以及解决办法

首先能访问需要公网IP,这个自行百度tp-link路由器里面有DDNS,打开这个,输入域名,使用     XXXXX.tpddns.cn   这个地址...

锐速WIN

http://dl.sndnote.com/rar/win-ruisu.rar...

VM虚拟机安装安卓9.0

https://osdn.net/projects/android-x86/releases在这里下载iso文件然后进行正常安装流程安装注意的几个点稍后安装系统Linux 版本Ubuntu64不要点完...

远程桌面 frp KCP UDP TCP

参考以下https://www.0z.gs/soso/817.htmlhttps://blog.csdn.net/menghuanbeike/article/details/100793876http...

firefox火狐浏览器的两种代理方式

第一种直接在火狐浏览器的网络界面设置第二种安装 FoxyProxy Standard 插件...

远程桌面VPS没有声音

远程桌面VPS没有声音

可能原因Windows弹性云服务器默认禁用音频设备,导致无法通过远程桌面的方式使用音频设备。如需播放音频、使用多媒体音频功能,可参见本节内容进行设置。第1步:启动Windows Audio服务启动Wi...