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

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

相关文章

一些需要知道的东西

一些需要知道的东西

整合自网络Part1:APP广告变现参与者服务需求方TD(Trading Desk)采购交易平台类似DSP,但需求方可以在TD上统一管理多个DSP平台的投放。DSP(Demand-Side Platf...

将Chrome浏览器扩展插件修改为手机版

将Chrome浏览器扩展插件修改为手机版

转载自:https://www.cccitu.com/2666.htmlYandex浏览器:这是目前可知最兼容电脑版Chrome扩展程序的安卓手机版浏览器。要知道,目前连官方安卓版 Chrome浏览器...

FRP内网穿透 WINDOWS批处理一键安装到系统服务后台运行

FRP内网穿透 WINDOWS批处理一键安装到系统服务后台运行

转载自:https://nat.ee/50.html由于frp在windows平台只能挂着命令行窗口运行,使用此批处理脚本后,直接安装到系统服务后台运行,更稳定/崩溃自动重启,等优点。下载链接:htt...

如何同时上内网和外网(转)

如何同时上内网和外网(转)

命令说明route print 打印路由信息route delete 清除默认网关route -p add 0.0.0.0 mask 0.0.0.0 192.168.1.254 添加默认网关为外网网关...

远程桌面空密码登陆(转)

远程桌面空密码登陆(转)

在工作过程中通常会遇到windows客户端,Administrator为空密码的情况,此时需要远程的话系统默认无法使用空密码登录。解决途径有两种:A. 增加一用户,设置管理员密码(未验证),或把gue...

远程桌面 frp KCP UDP TCP

远程桌面 frp KCP UDP TCP

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