Prechádzať zdrojové kódy

Remove stripping TURN-TLS servers as FF < 60 is not supported any more

Lennart Grahl 6 rokov pred
rodič
commit
6b1e89a7ba

+ 0 - 1
karma.conf.js

@@ -34,7 +34,6 @@ module.exports = function(config) {
             'tests/service/mime.js',
             'tests/service/qrcode.js',
             'tests/service/uri.js',
-            'tests/service/webclient.js',
             'tests/service/string.js',
             'tests/service/browser.js',
             'tests/service/keystore.js',

+ 0 - 24
src/services/webclient.ts

@@ -856,11 +856,6 @@ export class WebClientService {
         if (this.chosenTask === threema.ChosenTask.WebRTC) {
             const browser = this.browserService.getBrowser();
 
-            // Firefox <53 does not yet support TLS. Skip it, to save allocations.
-            if (browser.isFirefox(true) && browser.version < 53) {
-                this.skipIceTls();
-            }
-
             // Safari does not support our dual-stack TURN servers.
             if (browser.isSafari(false)) {
                 this.skipIceDs();
@@ -1363,25 +1358,6 @@ export class WebClientService {
         }
     }
 
-    /**
-     * Remove "turns:" servers from the ICE_SERVERS configuration
-     * if at least one "turn:" server with tcp transport is in the list.
-     */
-    public skipIceTls(): void {
-        this.arpLog.debug('Requested to remove TURN-TLS server from ICE configuration');
-        const allUrls = [].concat(...this.config.ICE_SERVERS.map((conf) => conf.urls));
-        if (allUrls.some((url) => url.startsWith('turn:') && url.endsWith('=tcp'))) {
-            // There's at least one TURN server with TCP transport in the list
-            for (const server of this.config.ICE_SERVERS) {
-                // Remove TLS entries
-                const urls = Array.isArray(server.urls) ? server.urls : [server.urls];
-                server.urls = urls.filter((url) => !url.startsWith('turns:'));
-            }
-        } else {
-            this.arpLog.debug('No fallback TURN-TCP server present, keeping TURN-TLS server');
-        }
-    }
-
     /**
      * Safari has issues with dual-stack TURN servers:
      * https://bugs.webkit.org/show_bug.cgi?id=173307#c13

+ 0 - 93
tests/service/webclient.js

@@ -1,93 +0,0 @@
-describe('WebClientService', function() {
-
-    let $service;
-
-    beforeEach(function() {
-
-        module(($provide) => {
-            // Provide configuration
-            $provide.constant('CONFIG', {
-                ICE_SERVERS: [
-                    {
-                        urls: [
-                            'turn:turn.threema.ch:443?transport=tcp',
-                            'turn:turn.threema.ch:443?transport=udp',
-                            'turns:turn.threema.ch:443?transport=tcp',
-                        ],
-                        username: 'user',
-                        credential: 'credential',
-                    },
-                ],
-            });
-
-            // Mock some dependencies that we don't really need
-            $provide.constant('PROTOCOL_VERSION', 1337);
-            $provide.constant('$state', null);
-            $provide.constant('$translate', null);
-        });
-
-        // Load modules
-        module('ngAria');
-        module('ngAnimate');
-        module('ngMaterial');
-        module('3ema.services');
-        module('3ema.container');
-
-        // Inject the service to be tested
-        inject(function(WebClientService) {
-            $service = WebClientService;
-        });
-
-    });
-
-    it('can skip ICE TLS hosts if a non-TLS TCP server is available', () => {
-        const allUrlsBefore = [].concat(...$service.config.ICE_SERVERS.map((conf) => conf.urls));
-        expect(allUrlsBefore.indexOf('turns:turn.threema.ch:443?transport=tcp')).not.toEqual(-1);
-
-        $service.skipIceTls();
-
-        const allUrlsAfter = [].concat(...$service.config.ICE_SERVERS.map((conf) => conf.urls));
-        expect(allUrlsAfter.length).toEqual(allUrlsBefore.length - 1);
-        expect(allUrlsAfter.indexOf('turns:turn.threema.ch:443?transport=tcp')).toEqual(-1);
-    });
-
-    it('can skip ICE TLS hosts if a non-TLS TCP server is available in another server object', () => {
-        $service.config.ICE_SERVERS = [
-            {
-                urls: ['turn:turn.threema.ch:443?transport=udp', 'turns:turn.threema.ch:443?transport=tcp'],
-                username: 'user', credential: 'credential',
-            },
-            {
-                urls: ['turn:turn.threema.ch:443?transport=tcp'],
-                username: 'user', credential: 'credential',
-            }
-        ];
-        const allUrlsBefore = [].concat(...$service.config.ICE_SERVERS.map((conf) => conf.urls));
-        expect(allUrlsBefore.indexOf('turns:turn.threema.ch:443?transport=tcp')).not.toEqual(-1);
-
-        $service.skipIceTls();
-
-        const allUrlsAfter = [].concat(...$service.config.ICE_SERVERS.map((conf) => conf.urls));
-        expect(allUrlsAfter.length).toEqual(allUrlsBefore.length - 1);
-        expect(allUrlsAfter.indexOf('turns:turn.threema.ch:443?transport=tcp')).toEqual(-1);
-    });
-
-    it('does not skip ICE TLS hosts if no non-TLS TCP server is available', () => {
-        $service.config.ICE_SERVERS = [
-            {
-                urls: ['turn:turn.threema.ch:443?transport=udp', 'turns:turn.threema.ch:443?transport=tcp'],
-                username: 'user',
-                credential: 'credential',
-            }
-        ];
-        const allUrlsBefore = [].concat(...$service.config.ICE_SERVERS.map((conf) => conf.urls));
-        expect(allUrlsBefore.indexOf('turns:turn.threema.ch:443?transport=tcp')).not.toEqual(-1);
-
-        $service.skipIceTls();
-
-        const allUrlsAfter = [].concat(...$service.config.ICE_SERVERS.map((conf) => conf.urls));
-        expect(allUrlsAfter.length).toEqual(allUrlsBefore.length);
-        expect(allUrlsAfter.indexOf('turns:turn.threema.ch:443?transport=tcp')).not.toEqual(-1);
-    });
-
-});

+ 0 - 1
tests/testsuite.html

@@ -38,7 +38,6 @@
         <script src="service/mime.js"></script>
         <script src="service/qrcode.js"></script>
         <script src="service/uri.js"></script>
-        <script src="service/webclient.js"></script>
         <script src="service/string.js"></script>
         <script src="service/browser.js"></script>
         <script src="service/keystore.js"></script>