mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
Some files were omitted in the .eslintignore, left as an exercise to the reader. We probably want to reduce amount of globals overall and use proper es modules.
30 lines
983 B
JavaScript
30 lines
983 B
JavaScript
/* global module, require */
|
|
|
|
/*
|
|
WebRTC shims for multiple browsers.
|
|
*/
|
|
|
|
if (typeof module !== "undefined" && module !== null ? module.exports : void 0) {
|
|
window = {};
|
|
document = {
|
|
getElementById: function() {
|
|
return null;
|
|
}
|
|
};
|
|
chrome = {};
|
|
location = { search: '' };
|
|
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 {
|
|
PeerConnection = window.RTCPeerConnection || window.mozRTCPeerConnection || window.webkitRTCPeerConnection;
|
|
IceCandidate = window.RTCIceCandidate || window.mozRTCIceCandidate;
|
|
SessionDescription = window.RTCSessionDescription || window.mozRTCSessionDescription;
|
|
WebSocket = window.WebSocket;
|
|
XMLHttpRequest = window.XMLHttpRequest;
|
|
}
|