webrtc-adapter
Advanced tools
Comparing version 6.1.5 to 6.2.0
{ | ||
"name": "webrtc-adapter", | ||
"version": "6.1.5", | ||
"version": "6.2.0", | ||
"description": "A shim to insulate apps from WebRTC spec changes and browser prefix differences", | ||
@@ -54,5 +54,4 @@ "license": "BSD-3-Clause", | ||
"sinon-chai": "^2.14.0", | ||
"tape": "^4.9.0", | ||
"travis-multirunner": "^4.4.0" | ||
} | ||
} |
@@ -76,2 +76,3 @@ /* | ||
chromeShim.shimGetSendersWithDtmf(window); | ||
chromeShim.shimSenderReceiverGetStats(window); | ||
@@ -98,2 +99,5 @@ commonShim.shimRTCIceCandidate(window); | ||
firefoxShim.shimRemoveStream(window); | ||
firefoxShim.shimSenderGetStats(window); | ||
firefoxShim.shimReceiverGetStats(window); | ||
firefoxShim.shimRTCDataChannel(window); | ||
@@ -100,0 +104,0 @@ commonShim.shimRTCIceCandidate(window); |
@@ -14,2 +14,43 @@ | ||
/* iterates the stats graph recursively. */ | ||
function walkStats(stats, base, resultSet) { | ||
if (!base || resultSet.has(base.id)) { | ||
return; | ||
} | ||
resultSet.set(base.id, base); | ||
Object.keys(base).forEach(function(name) { | ||
if (name.endsWith('Id')) { | ||
walkStats(stats, stats.get(base[name]), resultSet); | ||
} else if (name.endsWith('Ids')) { | ||
base[name].forEach(function(id) { | ||
walkStats(stats, stats.get(id), resultSet); | ||
}); | ||
} | ||
}); | ||
} | ||
/* filter getStats for a sender/receiver track. */ | ||
function filterStats(result, track, outbound) { | ||
var streamStatsType = outbound ? 'outbound-rtp' : 'inbound-rtp'; | ||
var filteredResult = new Map(); | ||
if (track === null) { | ||
return filteredResult; | ||
} | ||
var trackStats = []; | ||
result.forEach(function(value) { | ||
if (value.type === 'track' && | ||
value.trackIdentifier === track.id) { | ||
trackStats.push(value); | ||
} | ||
}); | ||
trackStats.forEach(function(trackStat) { | ||
result.forEach(function(stats) { | ||
if (stats.type === streamStatsType && stats.trackId === trackStat.id) { | ||
walkStats(result, stats, filteredResult); | ||
} | ||
}); | ||
}); | ||
return filteredResult; | ||
} | ||
module.exports = { | ||
@@ -195,2 +236,118 @@ shimGetUserMedia: require('./getusermedia'), | ||
shimSenderReceiverGetStats: function(window) { | ||
if (!(typeof window === 'object' && window.RTCPeerConnection && | ||
window.RTCRtpSender && window.RTCRtpReceiver)) { | ||
return; | ||
} | ||
// shim sender stats. | ||
if (!('getStats' in window.RTCRtpSender.prototype)) { | ||
var origGetSenders = window.RTCPeerConnection.prototype.getSenders; | ||
if (origGetSenders) { | ||
window.RTCPeerConnection.prototype.getSenders = function() { | ||
var pc = this; | ||
var senders = origGetSenders.apply(pc, []); | ||
senders.forEach(function(sender) { | ||
sender._pc = pc; | ||
}); | ||
return senders; | ||
}; | ||
} | ||
var origAddTrack = window.RTCPeerConnection.prototype.addTrack; | ||
if (origAddTrack) { | ||
window.RTCPeerConnection.prototype.addTrack = function() { | ||
var sender = origAddTrack.apply(this, arguments); | ||
sender._pc = this; | ||
return sender; | ||
}; | ||
} | ||
window.RTCRtpSender.prototype.getStats = function() { | ||
var sender = this; | ||
return this._pc.getStats().then(function(result) { | ||
/* Note: this will include stats of all senders that | ||
* send a track with the same id as sender.track as | ||
* it is not possible to identify the RTCRtpSender. | ||
*/ | ||
return filterStats(result, sender.track, true); | ||
}); | ||
}; | ||
} | ||
// shim receiver stats. | ||
if (!('getStats' in window.RTCRtpReceiver.prototype)) { | ||
var origGetReceivers = window.RTCPeerConnection.prototype.getReceivers; | ||
if (origGetReceivers) { | ||
window.RTCPeerConnection.prototype.getReceivers = function() { | ||
var pc = this; | ||
var receivers = origGetReceivers.apply(pc, []); | ||
receivers.forEach(function(receiver) { | ||
receiver._pc = pc; | ||
}); | ||
return receivers; | ||
}; | ||
} | ||
utils.wrapPeerConnectionEvent(window, 'track', function(e) { | ||
e.receiver._pc = e.srcElement; | ||
return e; | ||
}); | ||
window.RTCRtpReceiver.prototype.getStats = function() { | ||
var receiver = this; | ||
return this._pc.getStats().then(function(result) { | ||
return filterStats(result, receiver.track, false); | ||
}); | ||
}; | ||
} | ||
if (!('getStats' in window.RTCRtpSender.prototype && | ||
'getStats' in window.RTCRtpReceiver.prototype)) { | ||
return; | ||
} | ||
// shim RTCPeerConnection.getStats(track). | ||
var origGetStats = window.RTCPeerConnection.prototype.getStats; | ||
window.RTCPeerConnection.prototype.getStats = function() { | ||
var pc = this; | ||
if (arguments.length > 0 && | ||
arguments[0] instanceof window.MediaStreamTrack) { | ||
var track = arguments[0]; | ||
var sender; | ||
var receiver; | ||
var err; | ||
pc.getSenders().forEach(function(s) { | ||
if (s.track === track) { | ||
if (sender) { | ||
err = true; | ||
} else { | ||
sender = s; | ||
} | ||
} | ||
}); | ||
pc.getReceivers().forEach(function(r) { | ||
if (r.track === track) { | ||
if (receiver) { | ||
err = true; | ||
} else { | ||
receiver = r; | ||
} | ||
} | ||
return r.track === track; | ||
}); | ||
if (err || (sender && receiver)) { | ||
return Promise.reject(new DOMException( | ||
'There are more than one sender or receiver for the track.', | ||
'InvalidAccessError')); | ||
} else if (sender) { | ||
return sender.getStats(); | ||
} else if (receiver) { | ||
return receiver.getStats(); | ||
} | ||
return Promise.reject(new DOMException( | ||
'There is no sender or receiver for the track.', | ||
'InvalidAccessError')); | ||
} | ||
return origGetStats.apply(pc, arguments); | ||
}; | ||
}, | ||
shimSourceObject: function(window) { | ||
@@ -197,0 +354,0 @@ var URL = window && window.URL; |
@@ -172,3 +172,3 @@ /* | ||
} | ||
} else { | ||
} else if (browserDetails.version < 60) { | ||
// Currently, all FF >= 57 will reset the remote maximum message size | ||
@@ -180,2 +180,5 @@ // to the default value when a data channel is created at a later | ||
browserDetails.version === 57 ? 65535 : 65536; | ||
} else { | ||
// FF >= 60 supports sending ~2 GiB | ||
canSendMaxMessageSize = 2147483637; | ||
} | ||
@@ -263,2 +266,15 @@ } | ||
function wrapDcSend(dc, pc) { | ||
var origDataChannelSend = dc.send; | ||
dc.send = function() { | ||
var data = arguments[0]; | ||
var length = data.length || data.size || data.byteLength; | ||
if (dc.readyState === 'open' && | ||
pc.sctp && length > pc.sctp.maxMessageSize) { | ||
throw new TypeError('Message too large (can send a maximum of ' + | ||
pc.sctp.maxMessageSize + ' bytes)'); | ||
} | ||
return origDataChannelSend.apply(dc, arguments); | ||
}; | ||
} | ||
var origCreateDataChannel = | ||
@@ -269,19 +285,10 @@ window.RTCPeerConnection.prototype.createDataChannel; | ||
var dataChannel = origCreateDataChannel.apply(pc, arguments); | ||
var origDataChannelSend = dataChannel.send; | ||
// Patch 'send' method | ||
dataChannel.send = function() { | ||
var dc = this; | ||
var data = arguments[0]; | ||
var length = data.length || data.size || data.byteLength; | ||
if (length > pc.sctp.maxMessageSize) { | ||
throw new DOMException('Message too large (can send a maximum of ' + | ||
pc.sctp.maxMessageSize + ' bytes)', 'TypeError'); | ||
} | ||
return origDataChannelSend.apply(dc, arguments); | ||
}; | ||
wrapDcSend(dataChannel, pc); | ||
return dataChannel; | ||
}; | ||
utils.wrapPeerConnectionEvent(window, 'datachannel', function(e) { | ||
wrapDcSend(e.channel, e.target); | ||
return e; | ||
}); | ||
} | ||
}; |
@@ -12,2 +12,3 @@ /* | ||
var utils = require('../utils'); | ||
var filterIceServers = require('./filtericeservers'); | ||
var shimRTCPeerConnection = require('rtcpeerconnection-shim'); | ||
@@ -70,4 +71,11 @@ | ||
window.RTCPeerConnection = | ||
shimRTCPeerConnection(window, browserDetails.version); | ||
var RTCPeerConnectionShim = shimRTCPeerConnection(window, | ||
browserDetails.version); | ||
window.RTCPeerConnection = function(config) { | ||
if (config.iceServers) { | ||
config.iceServers = filterIceServers(config.iceServers); | ||
} | ||
return new RTCPeerConnectionShim(config); | ||
}; | ||
window.RTCPeerConnection.prototype = RTCPeerConnectionShim.prototype; | ||
}, | ||
@@ -74,0 +82,0 @@ shimReplaceTrack: function(window) { |
@@ -202,2 +202,64 @@ /* | ||
shimSenderGetStats: function(window) { | ||
if (!(typeof window === 'object' && window.RTCPeerConnection && | ||
window.RTCRtpSender)) { | ||
return; | ||
} | ||
if (window.RTCRtpSender && 'getStats' in window.RTCRtpSender.prototype) { | ||
return; | ||
} | ||
var origGetSenders = window.RTCPeerConnection.prototype.getSenders; | ||
if (origGetSenders) { | ||
window.RTCPeerConnection.prototype.getSenders = function() { | ||
var pc = this; | ||
var senders = origGetSenders.apply(pc, []); | ||
senders.forEach(function(sender) { | ||
sender._pc = pc; | ||
}); | ||
return senders; | ||
}; | ||
} | ||
var origAddTrack = window.RTCPeerConnection.prototype.addTrack; | ||
if (origAddTrack) { | ||
window.RTCPeerConnection.prototype.addTrack = function() { | ||
var sender = origAddTrack.apply(this, arguments); | ||
sender._pc = this; | ||
return sender; | ||
}; | ||
} | ||
window.RTCRtpSender.prototype.getStats = function() { | ||
return this.track ? this._pc.getStats(this.track) : | ||
Promise.resolve(new Map()); | ||
}; | ||
}, | ||
shimReceiverGetStats: function(window) { | ||
if (!(typeof window === 'object' && window.RTCPeerConnection && | ||
window.RTCRtpSender)) { | ||
return; | ||
} | ||
if (window.RTCRtpSender && 'getStats' in window.RTCRtpReceiver.prototype) { | ||
return; | ||
} | ||
var origGetReceivers = window.RTCPeerConnection.prototype.getReceivers; | ||
if (origGetReceivers) { | ||
window.RTCPeerConnection.prototype.getReceivers = function() { | ||
var pc = this; | ||
var receivers = origGetReceivers.apply(pc, []); | ||
receivers.forEach(function(receiver) { | ||
receiver._pc = pc; | ||
}); | ||
return receivers; | ||
}; | ||
} | ||
utils.wrapPeerConnectionEvent(window, 'track', function(e) { | ||
e.receiver._pc = e.srcElement; | ||
return e; | ||
}); | ||
window.RTCRtpReceiver.prototype.getStats = function() { | ||
return this._pc.getStats(this.track); | ||
}; | ||
}, | ||
shimRemoveStream: function(window) { | ||
@@ -217,3 +279,11 @@ if (!window.RTCPeerConnection || | ||
}; | ||
} | ||
}, | ||
shimRTCDataChannel: function(window) { | ||
// rename DataChannel to RTCDataChannel (native fix in FF60): | ||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1173851 | ||
if (window.DataChannel && !window.RTCDataChannel) { | ||
window.RTCDataChannel = window.DataChannel; | ||
} | ||
}, | ||
}; |
@@ -74,3 +74,5 @@ /* | ||
} | ||
} | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
@@ -77,0 +79,0 @@ } |
@@ -185,2 +185,4 @@ /* | ||
// You can use the following version comparators: '<=', '>=' and '=='. | ||
// Multiple comparators can be chained with ',' which is equivalent to the | ||
// logical AND. | ||
// | ||
@@ -212,3 +214,3 @@ // The innermost array contains the other browser's version, the expected | ||
], | ||
'firefox>=58': [ | ||
'firefox>=58,firefox<=59': [ | ||
['chrome>=0', 65536, 'v=0\r\no=- 6575128786484314789 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:oZF1\r\na=ice-pwd:8+qEgoDOiFd49nDG9oNSYYaz\r\na=ice-options:trickle\r\na=fingerprint:sha-256 F2:01:D6:88:9E:0C:F1:CE:EE:85:9C:B4:A5:B7:36:D4:CB:29:F2:4F:E0:97:81:25:34:00:71:65:2B:39:C1:C1\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n'], | ||
@@ -222,2 +224,11 @@ ['firefox<=56', 65536, 'v=0\r\no=mozilla...THIS_IS_SDPARTA-56.0.2 3250009914871290350 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 C8:36:D3:FD:E6:9A:B8:4E:7C:FB:61:03:22:E5:8E:E1:7D:17:AF:D2:EB:0F:87:BA:28:6C:9A:2E:76:D9:B3:0C\r\na=group:BUNDLE sdparta_0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:bb3ee909b8452eb93722d223b26d6193\r\na=ice-ufrag:1c03e3ae\r\na=mid:sdparta_0\r\na=sctpmap:5000 webrtc-datachannel 256\r\na=setup:actpass\r\n'], | ||
], | ||
'firefox>=60': [ | ||
['chrome>=0', 65536, 'v=0\r\no=- 6575128786484314789 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:oZF1\r\na=ice-pwd:8+qEgoDOiFd49nDG9oNSYYaz\r\na=ice-options:trickle\r\na=fingerprint:sha-256 F2:01:D6:88:9E:0C:F1:CE:EE:85:9C:B4:A5:B7:36:D4:CB:29:F2:4F:E0:97:81:25:34:00:71:65:2B:39:C1:C1\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n'], | ||
['firefox<=56', 2147483637, 'v=0\r\no=mozilla...THIS_IS_SDPARTA-56.0.2 3250009914871290350 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 C8:36:D3:FD:E6:9A:B8:4E:7C:FB:61:03:22:E5:8E:E1:7D:17:AF:D2:EB:0F:87:BA:28:6C:9A:2E:76:D9:B3:0C\r\na=group:BUNDLE sdparta_0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:bb3ee909b8452eb93722d223b26d6193\r\na=ice-ufrag:1c03e3ae\r\na=mid:sdparta_0\r\na=sctpmap:5000 webrtc-datachannel 256\r\na=setup:actpass\r\n'], | ||
['firefox>=57', 1073741823, 'v=0\r\no=mozilla...THIS_IS_SDPARTA-57.0 169150732617742973 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 8C:EB:14:5C:60:1E:E8:1E:FA:C7:D8:90:38:E9:EB:05:A8:2B:32:9F:FE:2B:D9:1C:85:3D:59:70:A9:6D:3A:17\r\na=group:BUNDLE sdparta_0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:c224ece79b15dcb92de87e2b67e62d7a\r\na=ice-ufrag:96c030e8\r\na=mid:sdparta_0\r\na=sctpmap:5000 webrtc-datachannel 256\r\na=setup:actpass\r\na=max-message-size:1073741823\r\n'], | ||
['64 KiB', 65536, 'v=0\r\no=- 6575128786484314789 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:oZF1\r\na=ice-pwd:8+qEgoDOiFd49nDG9oNSYYaz\r\na=ice-options:trickle\r\na=fingerprint:sha-256 F2:01:D6:88:9E:0C:F1:CE:EE:85:9C:B4:A5:B7:36:D4:CB:29:F2:4F:E0:97:81:25:34:00:71:65:2B:39:C1:C1\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\na=max-message-size:65536\r\n'], | ||
['1.5 GiB', 1610612736, 'v=0\r\no=1.5 GiB 169150732617742973 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 8C:EB:14:5C:60:1E:E8:1E:FA:C7:D8:90:38:E9:EB:05:A8:2B:32:9F:FE:2B:D9:1C:85:3D:59:70:A9:6D:3A:17\r\na=group:BUNDLE sdparta_0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:c224ece79b15dcb92de87e2b67e62d7a\r\na=ice-ufrag:96c030e8\r\na=mid:sdparta_0\r\na=sctpmap:5000 webrtc-datachannel 256\r\na=setup:actpass\r\na=max-message-size:1610612736\r\n'], | ||
['2 GiB', 2147483637, 'v=0\r\no=2 GiB 169150732617742973 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 8C:EB:14:5C:60:1E:E8:1E:FA:C7:D8:90:38:E9:EB:05:A8:2B:32:9F:FE:2B:D9:1C:85:3D:59:70:A9:6D:3A:17\r\na=group:BUNDLE sdparta_0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:c224ece79b15dcb92de87e2b67e62d7a\r\na=ice-ufrag:96c030e8\r\na=mid:sdparta_0\r\na=sctpmap:5000 webrtc-datachannel 256\r\na=setup:actpass\r\na=max-message-size:2147483648\r\n'], | ||
['Unlimited', 2147483637, 'v=0\r\no=Unlimited 169150732617742973 0 IN IP4 0.0.0.0\r\ns=-\r\nt=0 0\r\na=fingerprint:sha-256 8C:EB:14:5C:60:1E:E8:1E:FA:C7:D8:90:38:E9:EB:05:A8:2B:32:9F:FE:2B:D9:1C:85:3D:59:70:A9:6D:3A:17\r\na=group:BUNDLE sdparta_0\r\na=ice-options:trickle\r\na=msid-semantic:WMS *\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=sendrecv\r\na=ice-pwd:c224ece79b15dcb92de87e2b67e62d7a\r\na=ice-ufrag:96c030e8\r\na=mid:sdparta_0\r\na=sctpmap:5000 webrtc-datachannel 256\r\na=setup:actpass\r\na=max-message-size:0\r\n'], | ||
], | ||
'chrome>=0': [ | ||
@@ -245,11 +256,13 @@ ['chrome>=0', 65536, 'v=0\r\no=- 6575128786484314789 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE data\r\na=msid-semantic: WMS\r\nm=application 9 DTLS/SCTP 5000\r\nc=IN IP4 0.0.0.0\r\na=ice-ufrag:oZF1\r\na=ice-pwd:8+qEgoDOiFd49nDG9oNSYYaz\r\na=ice-options:trickle\r\na=fingerprint:sha-256 F2:01:D6:88:9E:0C:F1:CE:EE:85:9C:B4:A5:B7:36:D4:CB:29:F2:4F:E0:97:81:25:34:00:71:65:2B:39:C1:C1\r\na=setup:actpass\r\na=mid:data\r\na=sctpmap:5000 webrtc-datachannel 1024\r\n'], | ||
const matchesBrowser = (browserVersion, browserDetails_) => { | ||
return ['==', '<=', '>='].some((comparator) => { | ||
if (browserVersion.indexOf(comparator) !== -1) { | ||
const matchesBrowser = (browserVersions, browserDetails_) => { | ||
return browserVersions.split(',').every((browserVersion) => { | ||
return ['==', '<=', '>='].some((comparator) => { | ||
if (!browserVersion.includes(comparator)) { | ||
return false; | ||
} | ||
let [browser, version] = browserVersion.split(comparator); | ||
version = parseInt(version, 10); | ||
return browser === browserDetails_.browser | ||
&& matchesVersion(comparator, browserDetails_.version, version); | ||
} | ||
return false; | ||
&& matchesVersion(comparator, browserDetails_.version, version); | ||
}); | ||
}); | ||
@@ -256,0 +269,0 @@ }; |
@@ -41,2 +41,82 @@ /* | ||
}); | ||
describe('filtering of STUN and TURN servers', () => { | ||
const edgeVersion = 15025; | ||
const filterIceServers = require('../../src/js/edge/filtericeservers'); | ||
it('converts legacy url member to urls', () => { | ||
const result = filterIceServers([ | ||
{url: 'stun:stun.l.google.com'} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([ | ||
{urls: 'stun:stun.l.google.com'} | ||
]); | ||
}); | ||
it('filters STUN before r14393', () => { | ||
const result = filterIceServers([ | ||
{urls: 'stun:stun.l.google.com'} | ||
], 14392); | ||
expect(result).to.deep.equal([]); | ||
}); | ||
it('does not filter STUN without protocol after r14393', () => { | ||
const result = filterIceServers([ | ||
{urls: 'stun:stun.l.google.com'} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([ | ||
{urls: 'stun:stun.l.google.com'} | ||
]); | ||
}); | ||
it('does filter STUN with protocol even after r14393', () => { | ||
const result = filterIceServers([ | ||
{urls: 'stun:stun.l.google.com:19302?transport=udp'} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([]); | ||
}); | ||
it('filters incomplete TURN urls', () => { | ||
const result = filterIceServers([ | ||
{urls: 'turn:stun.l.google.com'}, | ||
{urls: 'turn:stun.l.google.com:19302'} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([]); | ||
}); | ||
it('filters TURN TCP', () => { | ||
const result = filterIceServers([ | ||
{urls: 'turn:stun.l.google.com:19302?transport=tcp'} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([]); | ||
}); | ||
describe('removes all but the first server of a type', () => { | ||
it('in separate entries', () => { | ||
const result = filterIceServers([ | ||
{urls: 'stun:stun.l.google.com'}, | ||
{urls: 'turn:stun.l.google.com:19301?transport=udp'}, | ||
{urls: 'turn:stun.l.google.com:19302?transport=udp'} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([ | ||
{urls: 'stun:stun.l.google.com'}, | ||
{urls: 'turn:stun.l.google.com:19301?transport=udp'} | ||
]); | ||
}); | ||
it('in urls entries', () => { | ||
const result = filterIceServers([ | ||
{urls: 'stun:stun.l.google.com'}, | ||
{urls: [ | ||
'turn:stun.l.google.com:19301?transport=udp', | ||
'turn:stun.l.google.com:19302?transport=udp' | ||
]} | ||
], edgeVersion); | ||
expect(result).to.deep.equal([ | ||
{urls: 'stun:stun.l.google.com'}, | ||
{urls: ['turn:stun.l.google.com:19301?transport=udp']} | ||
]); | ||
}); | ||
}); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
898452
25
73
21215
0