diff options
| author | jwijenbergh <jeroenwijenbergh@protonmail.com> | 2024-02-22 16:04:05 +0100 |
|---|---|---|
| committer | Jeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com> | 2024-02-23 10:40:50 +0100 |
| commit | eb0c7e7251a0038963436dcd77e6d92311f0bf8f (patch) | |
| tree | 1381a84baee5f4588750941fd299bfe3c0e11c38 | |
| parent | 84d3ab740d0637a88537e54110b8a6486c3bd118 (diff) | |
Wrappers Python: Add necessary callbacks for proxyguard
| -rw-r--r-- | wrappers/python/eduvpn_common/loader.py | 5 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/main.py | 7 | ||||
| -rw-r--r-- | wrappers/python/eduvpn_common/types.py | 2 |
3 files changed, 11 insertions, 3 deletions
diff --git a/wrappers/python/eduvpn_common/loader.py b/wrappers/python/eduvpn_common/loader.py index d608e71..c7c2233 100644 --- a/wrappers/python/eduvpn_common/loader.py +++ b/wrappers/python/eduvpn_common/loader.py @@ -6,6 +6,8 @@ from ctypes import CDLL, c_char_p, c_int, c_void_p, cdll from eduvpn_common import __version__ from eduvpn_common.types import ( BoolError, + GotProxyFD, + ProxyReady, DataError, ReadRxBytes, TokenGetter, @@ -130,5 +132,6 @@ def initialize_functions(lib: CDLL) -> None: c_char_p, c_int, c_char_p, - c_void_p, + GotProxyFD, + ProxyReady, ], c_void_p diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py index cd26ca4..ea0ebb3 100644 --- a/wrappers/python/eduvpn_common/main.py +++ b/wrappers/python/eduvpn_common/main.py @@ -5,6 +5,8 @@ from typing import Any, Callable, Iterator, Optional from eduvpn_common.loader import initialize_functions, load_lib from eduvpn_common.types import ( + GotProxyFD, + ProxyReady, ReadRxBytes, TokenGetter, TokenSetter, @@ -345,13 +347,14 @@ class EduVPN(object): forwardError(dropped_err) return dropped - def start_proxyguard(self, listen: str, source_port: int, peer: str): + def start_proxyguard(self, listen: str, source_port: int, peer: str, gotfd: GotProxyFD, ready: ProxyReady): proxy_err = self.go_cookie_function( self.lib.StartProxyguard, listen, source_port, peer, - 0, + gotfd, + ready, ) if proxy_err: forwardError(proxy_err) diff --git a/wrappers/python/eduvpn_common/types.py b/wrappers/python/eduvpn_common/types.py index e2498b3..e46522a 100644 --- a/wrappers/python/eduvpn_common/types.py +++ b/wrappers/python/eduvpn_common/types.py @@ -34,6 +34,8 @@ class BoolError(Structure): # The type for a Go state change callback VPNStateChange = CFUNCTYPE(c_int, c_int, c_int, c_char_p) +GotProxyFD = CFUNCTYPE(c_void_p, c_int) +ProxyReady = CFUNCTYPE(c_void_p) ReadRxBytes = CFUNCTYPE(c_ulonglong) TokenGetter = CFUNCTYPE(c_void_p, c_char_p, c_int, POINTER(c_char), c_size_t) TokenSetter = CFUNCTYPE(c_void_p, c_char_p, c_int, c_char_p) |
