summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/services/eip/eipconfig.py
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@gmail.com>2015-03-04 18:03:47 -0300
committerRuben Pollan <meskio@sindominio.net>2015-03-30 22:42:52 +0200
commit3cb7948dafe3a9c9a65dcdbd1da1d5405e1ef459 (patch)
treeddf0f171313e13dd8a776a5119a88ecccd187ec1 /src/leap/bitmask/services/eip/eipconfig.py
parent6e8639a480d63acd5c8bc044a8b1ca907c325233 (diff)
[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
Diffstat (limited to 'src/leap/bitmask/services/eip/eipconfig.py')
-rw-r--r--src/leap/bitmask/services/eip/eipconfig.py18
1 files changed, 18 insertions, 0 deletions
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):