diff options
| -rw-r--r-- | src/leap/bitmask/cli/vpn.py | 19 | ||||
| -rw-r--r-- | src/leap/bitmask/vpn/service.py | 8 | 
2 files changed, 19 insertions, 8 deletions
| diff --git a/src/leap/bitmask/cli/vpn.py b/src/leap/bitmask/cli/vpn.py index 44556ac2..5a9cce9e 100644 --- a/src/leap/bitmask/cli/vpn.py +++ b/src/leap/bitmask/cli/vpn.py @@ -20,6 +20,8 @@ Bitmask Command Line interface: vpn module  import argparse  import sys +from colorama import Fore +  from leap.bitmask.cli import command @@ -97,7 +99,7 @@ SUBCOMMANDS:      def list(self, raw_args):          self.data += ['list'] -        return self._send(command.default_dict_printer) +        return self._send(location_printer)      def get_cert(self, raw_args):          parser = argparse.ArgumentParser( @@ -115,3 +117,18 @@ SUBCOMMANDS:          self.data += ['get_cert', uid]          return self._send(command.default_dict_printer) + + +def location_printer(result): +    def pprint(key, value): +        print(Fore.RESET + key.ljust(20) + Fore.GREEN + +              value + Fore.RESET) + +    for provider, locations in result.items(): +        for loc in locations.values(): +            location_str = ("[%(country_code)s] %(name)s " +                            "(UTC%(timezone)s %(hemisphere)s)" % loc) +            pprint(provider, location_str) + +        if not locations.values(): +            pprint(provider, "---") diff --git a/src/leap/bitmask/vpn/service.py b/src/leap/bitmask/vpn/service.py index 71fb8651..f4af3036 100644 --- a/src/leap/bitmask/vpn/service.py +++ b/src/leap/bitmask/vpn/service.py @@ -194,13 +194,7 @@ class VPNService(HookableService):                  config = yield bonafide.do_provider_read(provider, 'eip')              except ValueError:                  continue -            locations = config.locations -            info = tuple([ -                ('[%s]' % locations[loc]['country_code'], -                 locations[loc]['name'], -                 '(UTC%s)' % locations[loc]['timezone']) -                for loc in locations]) -            provider_dict[provider] = info +            provider_dict[provider] = config.locations          defer.returnValue(provider_dict)      @defer.inlineCallbacks | 
