mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
31 lines
1 KiB
JavaScript
31 lines
1 KiB
JavaScript
/*
|
|
WebRTC shims for multiple browsers.
|
|
*/
|
|
|
|
if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
|
|
window = {};
|
|
document = {
|
|
getElementById: function() {
|
|
return null;
|
|
}
|
|
};
|
|
chrome = {};
|
|
location = '';
|
|
if ((typeof TESTING === "undefined" || TESTING === null) || !TESTING) {
|
|
webrtc = require('wrtc');
|
|
PeerConnection = webrtc.RTCPeerConnection;
|
|
IceCandidate = webrtc.RTCIceCandidate;
|
|
SessionDescription = webrtc.RTCSessionDescription;
|
|
WebSocket = require('ws');
|
|
({ XMLHttpRequest } = require('xmlhttprequest'));
|
|
}
|
|
} else {
|
|
document = window.document;
|
|
chrome = window.chrome;
|
|
location = window.location.search.substr(1);
|
|
PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
|
|
IceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate;
|
|
SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription;
|
|
WebSocket = window.WebSocket;
|
|
XMLHttpRequest = window.XMLHttpRequest;
|
|
}
|