diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-12-20 15:35:44 +0100 |
|---|---|---|
| committer | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2022-12-21 18:28:00 +0100 |
| commit | 6981666c6d8f639a1ff9c09a3bc08769e19928af (patch) | |
| tree | bdb94d76a7fb6a08ef200e9bbbbd5fff1d6b134c /wrappers/python/eduvpn_common/main.py | |
| parent | 697dfed1f9f5d2916889a81a7a64bd1158caf2d2 (diff) | |
Failover: Initial implementation
Diffstat (limited to 'wrappers/python/eduvpn_common/main.py')
| -rw-r--r-- | wrappers/python/eduvpn_common/main.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index 20d646f..3cb45e1 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -7,7 +7,7 @@ from eduvpn_common.event import EventHandler from eduvpn_common.loader import initialize_functions, load_lib from eduvpn_common.server import Profiles, Server, get_transition_server, get_servers from eduvpn_common.state import State, StateType -from eduvpn_common.types import VPNStateChange, decode_res, encode_args, get_data_error +from eduvpn_common.types import ReadRxBytes, VPNStateChange, decode_res, encode_args, get_data_error, get_bool class EduVPN(object): @@ -502,6 +502,20 @@ class EduVPN(object): return servers + def start_failover(self, gateway: str, wg_mtu: int, readrxbytes: ReadRxBytes) -> bool: + dropped, dropped_err = self.go_function( + self.lib.StartFailover, gateway, wg_mtu, readrxbytes, + decode_func=lambda lib, x: get_data_error(lib, x, get_bool), + ) + if dropped_err: + raise dropped_err + return dropped + + def cancel_failover(self): + cancel_err = self.go_function(self.lib.CancelFailover) + if cancel_err: + raise cancel_err + eduvpn_objects: Dict[str, EduVPN] = {} |
