From 1d09d1a079f8ce577de13ab43c2e9add7a6247bc Mon Sep 17 00:00:00 2001 From: Ruben Pollan Date: Fri, 17 Mar 2017 00:44:00 +0100 Subject: [bug] let's remove hardcoded providers --- src/leap/bitmask/vpn/_status.py | 5 ++++- src/leap/bitmask/vpn/manager.py | 8 +++----- src/leap/bitmask/vpn/service.py | 2 +- src/leap/bitmask/vpn/vpn.py | 4 ++-- 4 files changed, 10 insertions(+), 9 deletions(-) (limited to 'src/leap/bitmask/vpn') diff --git a/src/leap/bitmask/vpn/_status.py b/src/leap/bitmask/vpn/_status.py index 7c8ff6b0..d4e8778e 100644 --- a/src/leap/bitmask/vpn/_status.py +++ b/src/leap/bitmask/vpn/_status.py @@ -52,8 +52,11 @@ class VPNStatus(object): self.set_status(status, errcode) def set_status(self, status, errcode): - if status in ("AUTH", "WAIT"): + if status in ("AUTH", "WAIT", "CONNECTING", "GET_CONFIG", + "ASSIGN_IP", "ADD_ROUTES", "RECONNECTING"): status = "starting" + elif status == "EXITING": + status = "stopping" elif status == "CONNECTED": status = "on" diff --git a/src/leap/bitmask/vpn/manager.py b/src/leap/bitmask/vpn/manager.py index 88d10bb7..66fc3d50 100644 --- a/src/leap/bitmask/vpn/manager.py +++ b/src/leap/bitmask/vpn/manager.py @@ -32,7 +32,8 @@ from .constants import IS_WIN class TunnelManager(object): - def __init__(self, remotes, cert_path, key_path, ca_path, extra_flags): + def __init__(self, provider, remotes, cert_path, key_path, ca_path, + extra_flags): """ Initialize the VPNManager object. @@ -48,13 +49,10 @@ class TunnelManager(object): ports = [] - # TODO fix hardcoding - domain = "demo.bitmask.net" - self._remotes = remotes self._vpnconfig = _TempVPNConfig(extra_flags, cert_path, ports) - self._providerconfig = _TempProviderConfig(domain, ca_path) + self._providerconfig = _TempProviderConfig(provider, ca_path) host, port = self._get_management_location() self._vpn = VPNControl(remotes=remotes, diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 2c7c69ce..0a26b28c 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -150,5 +150,5 @@ class VPNService(HookableService): cert_path = key_path = prefix + "/client/openvpn.pem" ca_path = prefix + "/ca/cacert.pem" - self._vpn = VPNManager(remotes, cert_path, key_path, ca_path, + self._vpn = VPNManager(provider, remotes, cert_path, key_path, ca_path, extra_flags) diff --git a/src/leap/bitmask/vpn/vpn.py b/src/leap/bitmask/vpn/vpn.py index dc3062af..5c9e46e3 100644 --- a/src/leap/bitmask/vpn/vpn.py +++ b/src/leap/bitmask/vpn/vpn.py @@ -25,10 +25,10 @@ from leap.bitmask.vpn.fw.firewall import FirewallManager class VPNManager(object): - def __init__(self, remotes, cert, key, ca, flags): + def __init__(self, provider, remotes, cert, key, ca, flags): self._vpn = TunnelManager( - remotes, cert, key, ca, flags) + provider, remotes, cert, key, ca, flags) self._firewall = FirewallManager(remotes) def start(self): -- cgit v1.2.3