From f583a28694be3ec3b99318673c6cdb6e42ee1372 Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Wed, 16 Aug 2023 13:25:15 +0200 Subject: Client + Exports + Python: Add a startup boolean to getconfig To be used for autoconnect on startup. If autoconnect on startup set to true This ignores any callbacks that require user input (profile, authorization & location callbacks) --- wrappers/python/eduvpn_common/loader.py | 1 + wrappers/python/eduvpn_common/main.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) (limited to 'wrappers/python') diff --git a/wrappers/python/eduvpn_common/loader.py b/wrappers/python/eduvpn_common/loader.py index 75a6a0a..7da159c 100644 --- a/wrappers/python/eduvpn_common/loader.py +++ b/wrappers/python/eduvpn_common/loader.py @@ -74,6 +74,7 @@ def initialize_functions(lib: CDLL) -> None: c_int, c_char_p, c_int, + c_int, ], DataError lib.AddServer.argtypes, lib.AddServer.restype = [ c_int, diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index 335b78c..5ee0882 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -208,14 +208,18 @@ class EduVPN(object): return yes def get_config( - self, _type: ServerType, identifier: str, prefer_tcp: bool = False + self, + _type: ServerType, + identifier: str, + prefer_tcp: bool = False, + startup: bool = False, ) -> str: """Get an OpenVPN/WireGuard configuration from the server :param _type: ServerType: The type of server e.g. SERVER.INSTITUTE_ACCESS :param identifier: str: The identifier of the server, e.g. URL or ORG ID :param prefer_tcp: bool: (Default value = False): Whether or not to prefer TCP - :param tokens: str (Defualt value = ""): The OAuth tokens if available + :param startup: bool: (Default value = False): Whether or not the client is just starting up :meta private: @@ -232,6 +236,7 @@ class EduVPN(object): int(_type), identifier, prefer_tcp, + startup, ) if config_err: @@ -377,7 +382,9 @@ def state_callback(old_state: int, new_state: int, data: str) -> int: global global_object if global_object is None: return 0 - handled = global_object.event_handler.run(State(old_state), State(new_state), data.decode("utf-8")) + handled = global_object.event_handler.run( + State(old_state), State(new_state), data.decode("utf-8") + ) if handled: return 1 return 0 -- cgit v1.2.3