From 05c180e7b28c4659b55e5bf1ebc4847e5b62230e Mon Sep 17 00:00:00 2001 From: jwijenbergh Date: Mon, 12 Aug 2024 11:33:52 +0200 Subject: Util: Add a function to calculate the gateway --- wrappers/python/eduvpn_common/main.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'wrappers/python/eduvpn_common/main.py') 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 -- cgit v1.2.3