summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-07-12 14:59:50 +0200
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-07-12 14:59:50 +0200
commitffbc91079b6c425976fcefbb528f0c180f7971e2 (patch)
treedb713b29ea2ed9bbea2cabd0d13978aa96f5f44c
parentf287501fde1be3bd7cb2bc2c163d309738e507a0 (diff)
Python + Exports: Implement Go back
-rw-r--r--exports/exports.go11
-rw-r--r--wrappers/python/src/__init__.py1
-rw-r--r--wrappers/python/src/main.py4
3 files changed, 16 insertions, 0 deletions
diff --git a/exports/exports.go b/exports/exports.go
index aa2b40e..331270f 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -215,6 +215,17 @@ func GetIdentifier(name *C.char) (*C.char, *C.char) {
return C.CString(identifier), C.CString("")
}
+//export GoBack
+func GoBack(name *C.char) (*C.char) {
+ nameStr := C.GoString(name)
+ state, stateErr := GetVPNState(nameStr)
+ if stateErr != nil {
+ return C.CString(ErrorToString(stateErr))
+ }
+ goBackErr := state.GoBack()
+ return C.CString(ErrorToString(goBackErr))
+}
+
//export SetIdentifier
func SetIdentifier(name *C.char, identifier *C.char) *C.char {
nameStr := C.GoString(name)
diff --git a/wrappers/python/src/__init__.py b/wrappers/python/src/__init__.py
index 0451f61..a1f8b40 100644
--- a/wrappers/python/src/__init__.py
+++ b/wrappers/python/src/__init__.py
@@ -74,6 +74,7 @@ lib.GetDiscoOrganizations.argtypes, lib.GetDiscoOrganizations.restype = [
c_char_p
], DataError
lib.GetDiscoServers.argtypes, lib.GetDiscoServers.restype = [c_char_p], DataError
+lib.GoBack.argtypes, lib.GoBack.restype = [c_char_p], None
lib.CancelOAuth.argtypes, lib.CancelOAuth.restype = [c_char_p], c_void_p
lib.SetProfileID.argtypes, lib.SetProfileID.restype = [c_char_p, c_char_p], c_void_p
lib.SetSecureLocation.argtypes, lib.SetSecureLocation.restype = [
diff --git a/wrappers/python/src/main.py b/wrappers/python/src/main.py
index 4868fca..84be0ab 100644
--- a/wrappers/python/src/main.py
+++ b/wrappers/python/src/main.py
@@ -134,6 +134,10 @@ class EduVPN(object):
self.location_event = threading.Event()
return self.get_config(url, lib.GetConfigSecureInternet, force_tcp)
+ def go_back(self) -> None:
+ # Ignore the error
+ self.go_function(lib.GoBack)
+
def set_connected(self) -> None:
connect_err = self.go_function(lib.SetConnected)