summaryrefslogtreecommitdiff
path: root/wrappers/python
diff options
context:
space:
mode:
Diffstat (limited to 'wrappers/python')
-rw-r--r--wrappers/python/eduvpn_common/loader.py1
-rw-r--r--wrappers/python/eduvpn_common/main.py17
2 files changed, 18 insertions, 0 deletions
diff --git a/wrappers/python/eduvpn_common/loader.py b/wrappers/python/eduvpn_common/loader.py
index 4bfc55f..e163148 100644
--- a/wrappers/python/eduvpn_common/loader.py
+++ b/wrappers/python/eduvpn_common/loader.py
@@ -99,6 +99,7 @@ def initialize_functions(lib: CDLL) -> None:
],
c_void_p,
)
+ lib.CalculateGateway.argtypes, lib.CalculateGateway.restype = [c_char_p], DataError
lib.Cleanup.argtypes, lib.Cleanup.restype = [c_int], c_void_p
lib.SetProfileID.argtypes, lib.SetProfileID.restype = [c_char_p], c_void_p
lib.CookieNew.argtypes, lib.CookieNew.restype = [], c_int
diff --git a/wrappers/python/eduvpn_common/main.py b/wrappers/python/eduvpn_common/main.py
index 8c556e9..ce52024 100644
--- a/wrappers/python/eduvpn_common/main.py
+++ b/wrappers/python/eduvpn_common/main.py
@@ -152,6 +152,23 @@ class EduVPN(object):
if register_err:
forwardError(register_err)
+ def calculate_gateway(self, subnet: str) -> str:
+ """Calculate the gateway
+
+ :param subnet: str: The IPv4/IPv6 subnet in CIDR notation
+
+ :raises WrappedError: An error by the Go library
+ """
+ gw, gw_err = self.go_function(
+ self.lib.CalculateGateway,
+ subnet,
+ )
+
+ if gw_err:
+ forwardError(gw_err)
+
+ return gw
+
def add_server(self, _type: ServerType, _id: str, ot: Optional[int] = None) -> None:
"""Add a server