From 3cb7948dafe3a9c9a65dcdbd1da1d5405e1ef459 Mon Sep 17 00:00:00 2001 From: Ivan Alejandro Date: Wed, 4 Mar 2015 18:03:47 -0300 Subject: [bug] use ports specified in eip-service.json Replace the hardcoded port '1194' for the port specified in eip-service.json. Choose the best port to use according which one is enabled in the eip-service.json file Resolves: #6541 --- src/leap/bitmask/services/eip/eipconfig.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/leap/bitmask/services/eip/eipconfig.py') diff --git a/src/leap/bitmask/services/eip/eipconfig.py b/src/leap/bitmask/services/eip/eipconfig.py index f4d6b216..d5947eb1 100644 --- a/src/leap/bitmask/services/eip/eipconfig.py +++ b/src/leap/bitmask/services/eip/eipconfig.py @@ -302,6 +302,24 @@ class EIPConfig(ServiceConfig): logger.error("Invalid ip address in config: %s" % (ip_addr_str,)) return None + def get_gateway_ports(self, index=0): + """ + Return the ports of the gateway. + + :param index: the gateway number to get the ports from + :type index: int + + :rtype: list of int + """ + gateways = self.get_gateways() + leap_assert(len(gateways) > 0, "We don't have any gateway!") + if index > len(gateways): + index = 0 + logger.warning("Provided an unknown gateway index %s, " + + "defaulting to 0") + + return gateways[index]["capabilities"]["ports"] + def get_client_cert_path(self, providerconfig=None, about_to_download=False): -- cgit v1.2.3