summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-22 14:42:20 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-03-22 14:42:20 +0100
commit22f9d7bafc60f56259e74df98e544b5820cfca5b (patch)
treefdc4886d035d04623666cb3132f3054bda77e889 /exports
parenteb5a1f2e9d47530c1896f49a2c4e7ffc82bcce4f (diff)
Save a local copy of the disco list
Diffstat (limited to 'exports')
-rw-r--r--exports/exports.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/exports/exports.go b/exports/exports.go
index 0bed7ba..c6a6a91 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -37,6 +37,29 @@ func Register(name *C.char, config_directory *C.char, stateCallback C.PythonCB)
eduvpn.Register(eduvpn.GetVPNState(), C.GoString(name), C.GoString(config_directory), StateCallback)
}
+func ErrorToString(error error) string {
+ if error == nil {
+ return ""
+ }
+
+ return error.Error()
+}
+
+//export GetOrganizationsList
+func GetOrganizationsList() (*C.char, *C.char) {
+ state := eduvpn.GetVPNState()
+ organizations, organizationsErr := state.GetOrganizationsList()
+ return C.CString(organizations), C.CString(ErrorToString(organizationsErr))
+}
+
+
+//export GetServersList
+func GetServersList() (*C.char, *C.char) {
+ state := eduvpn.GetVPNState()
+ servers, serversErr := state.GetServersList()
+ return C.CString(servers), C.CString(ErrorToString(serversErr))
+}
+
//export FreeString
func FreeString(addr *C.char) {
C.free(unsafe.Pointer(addr))