diff options
author | Tomás Touceda <chiiph@leap.se> | 2013-06-27 10:31:30 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2013-06-27 10:31:30 -0300 |
commit | d605043f5754f4f1ea6169a0cfb164928eb9e55a (patch) | |
tree | debe9002c94b8169c285626de71a49d73fe5d952 /src/leap/services/eip/eipconfig.py | |
parent | 4bfe0d08c2fce9ae35f92e40508830e1304adb9c (diff) | |
parent | 0fe9f43baf0d9da887d595384f100146f27f2393 (diff) |
Merge remote-tracking branch 'ivan/feature/improve_vpngatewayselector_tests' into develop
Diffstat (limited to 'src/leap/services/eip/eipconfig.py')
-rw-r--r-- | src/leap/services/eip/eipconfig.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/leap/services/eip/eipconfig.py b/src/leap/services/eip/eipconfig.py index 97eb3dfb..9e3a9b29 100644 --- a/src/leap/services/eip/eipconfig.py +++ b/src/leap/services/eip/eipconfig.py @@ -37,6 +37,8 @@ class VPNGatewaySelector(object): """ VPN Gateway selector. """ + # http://www.timeanddate.com/time/map/ + equivalent_timezones = {13: -11, 14: -10} def __init__(self, eipconfig, tz_offset=None): ''' @@ -51,7 +53,12 @@ class VPNGatewaySelector(object): self._local_offset = tz_offset if tz_offset is None: - self._local_offset = self._get_local_offset() + tz_offset = self._get_local_offset() + + if tz_offset in self.equivalent_timezones: + tz_offset = self.equivalent_timezones[tz_offset] + + self._local_offset = tz_offset self._eipconfig = eipconfig @@ -71,6 +78,9 @@ class VPNGatewaySelector(object): if gateway_location is not None: gw_offset = int(locations[gateway['location']]['timezone']) + if gw_offset in self.equivalent_timezones: + gw_offset = self.equivalent_timezones[gw_offset] + gateway_distance = self._get_timezone_distance(gw_offset) ip = self._eipconfig.get_gateway_ip(idx) |