mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 20:11:19 -04:00
35 lines
906 B
CoffeeScript
35 lines
906 B
CoffeeScript
###
|
|
WebRTC shims for multiple browsers.
|
|
###
|
|
|
|
if module?.exports
|
|
window = {}
|
|
document =
|
|
getElementById: () -> null
|
|
chrome = {}
|
|
location = ''
|
|
|
|
if not TESTING? or not TESTING
|
|
webrtc = require 'wrtc'
|
|
|
|
PeerConnection = webrtc.RTCPeerConnection
|
|
IceCandidate = webrtc.RTCIceCandidate
|
|
SessionDescription = webrtc.RTCSessionDescription
|
|
|
|
WebSocket = require 'ws'
|
|
{ XMLHttpRequest } = require 'xmlhttprequest'
|
|
|
|
else
|
|
window = this
|
|
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
|