diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-01 02:55:05 +0200 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2017-06-01 02:55:05 +0200 |
commit | 2db7202e6c3a520a5b6fe395dd74d40d8e53c481 (patch) | |
tree | abe64597254360a130692eaa65780990f43a12a5 /src/leap/bitmask/vpn/_control.py | |
parent | 6f02e93d436f8c36f80453a042e406a041d24c4f (diff) |
[refactor] hide mac/linux switch inside process module
Diffstat (limited to 'src/leap/bitmask/vpn/_control.py')
-rw-r--r-- | src/leap/bitmask/vpn/_control.py | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/leap/bitmask/vpn/_control.py b/src/leap/bitmask/vpn/_control.py index 8211e622..74182a9e 100644 --- a/src/leap/bitmask/vpn/_control.py +++ b/src/leap/bitmask/vpn/_control.py @@ -5,8 +5,8 @@ from twisted.internet.task import LoopingCall from twisted.internet import reactor from twisted.logger import Logger -from .process import VPNProcess, VPNCanary -from .constants import IS_LINUX, IS_MAC +from .process import VPNProcess +from .constants import IS_MAC log = Logger() @@ -57,16 +57,10 @@ class VPNControl(object): kwargs = {'openvpn_verb': 7, 'remotes': self._remotes, 'restartfun': self.restart} - if IS_LINUX: - vpnproc = VPNProcess(*args, **kwargs) - if vpnproc.get_openvpn_process(): - log.info('Another vpn process is running. Will try to stop it.') - vpnproc.stop_if_already_running() - elif IS_MAC: - # start the main vpn subprocess - vpnproc = VPNCanary(*args, **kwargs) - else: - raise Exception('This platform does not support VPN yet!') + vpnproc = VPNProcess(*args, **kwargs) + if vpnproc.get_openvpn_process(): + log.info('Another vpn process is running. Will try to stop it.') + vpnproc.stop_if_already_running() try: cmd = vpnproc.getCommand() |