diff options
author | Kali Kaneko <kali@leap.se> | 2017-08-11 00:59:56 +0200 |
---|---|---|
committer | Kali Kaneko <kali@leap.se> | 2017-08-11 14:21:57 -0400 |
commit | d64f3c22c132c5de0d759d1e76ff7ced054bfcaa (patch) | |
tree | cf14b625d1206ccdf44769f3ee2e14985730dc0d /src/leap/bitmask/vpn/launcher.py | |
parent | 763f88658a4e6d12557c7931f5435ebd35548ca7 (diff) |
[feature] automatic vpn gateway selection, based on timezone
This is a first approach to automatic gateways selection.
More things are missing:
- allow manual selection, by location or country code.
- take the hemisphere into account.
- expose the selected gw to the api/cli
but overall seems this is a good approach to make 0.10 release usable in
terms of vpn.
- Resolves: #8804
Diffstat (limited to 'src/leap/bitmask/vpn/launcher.py')
-rw-r--r-- | src/leap/bitmask/vpn/launcher.py | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/leap/bitmask/vpn/launcher.py b/src/leap/bitmask/vpn/launcher.py index 466f6d8a..5f4881c7 100644 --- a/src/leap/bitmask/vpn/launcher.py +++ b/src/leap/bitmask/vpn/launcher.py @@ -109,57 +109,6 @@ class VPNLauncher(object): PREFERRED_PORTS = ("443", "80", "53", "1194") - # FIXME -- dead code? - @classmethod - @abstractmethod - def get_gateways(kls, vpnconfig, providerconfig): - """ - Return a list with the selected gateways for a given provider, looking - at the VPN config file. - Each item of the list is a tuple containing (gateway, port). - - :param vpnconfig: vpn configuration object - :type vpnconfig: VPNConfig - - :param providerconfig: provider specific configuration - :type providerconfig: ProviderConfig - - :rtype: list - """ - gateways = [] - - settings = Settings() - domain = providerconfig.get_domain() - gateway_conf = settings.get_selected_gateway(domain) - gateway_selector = VPNGatewaySelector(vpnconfig) - - if gateway_conf == GATEWAY_AUTOMATIC: - gws = gateway_selector.get_gateways() - else: - gws = [gateway_conf] - - if not gws: - log.error('No gateway was found!') - raise VPNLauncherException('No gateway was found!') - - for idx, gw in enumerate(gws): - ports = vpnconfig.get_gateway_ports(idx) - - the_port = "1194" # default port - - # pick the port preferring this order: - for port in kls.PREFERRED_PORTS: - if port in ports: - the_port = port - break - else: - continue - - gateways.append((gw, the_port)) - - log.debug('Using gateways (ip, port): {0!r}'.format(gateways)) - return gateways - @classmethod @abstractmethod def get_vpn_command(kls, vpnconfig, providerconfig, |