OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 NaClTerm.nmf = 'tor.nmf'; |
| 8 |
| 9 /* check whether another instance of this app is running |
| 10 #TODO(dt) check if default port is occupied |
| 11 #TODO(dt) check if(allowed) another tor process is running outside chrome. */ |
| 12 function anotherTorRunning(){ |
| 13 // since chrome 34 multiple windows in apps are not allowed by default |
| 14 // thus returning false without any checking, (for now) |
| 15 // return NaClTerm.started; |
| 16 return false; |
| 17 } |
| 18 |
| 19 function populateArgv() { |
| 20 //TODO(dt) get parameters from storage once GUI is ready. |
| 21 //tor socks proxy port |
| 22 NaClTerm.argv = ['--SOCKSPort', '9999']; |
| 23 //playing it safe for now,tor creates relays/bridges through |
| 24 // these addresses only |
| 25 NaClTerm.argv = NaClTerm.argv.concat(['ReachableAddresses','*:80,*:443']); |
| 26 } |
| 27 |
| 28 function runTor() { |
| 29 if(!anotherTorRunning()){ |
| 30 populateArgv(); |
| 31 NaClTerm.init(); |
| 32 } |
| 33 } |
| 34 |
| 35 window.onload = function() { |
| 36 lib.init(function() { |
| 37 runTor(); |
| 38 }); |
| 39 }; |
OLD | NEW |