summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-02-14 13:32:02 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-05 12:26:11 +0200
commitc961faa8d7ba02e601586c3ce531b2329c7b258e (patch)
tree6afe9fa6141f3b32f9eb0fe7516b6b24d0796356 /exports
parentba16e07ca74e2d0211808718dd1ffc9611b36ec2 (diff)
Python: Expose getting servers list
Signed-off-by: jwijenbergh <jeroenwijenbergh@protonmail.com>
Diffstat (limited to 'exports')
-rw-r--r--exports/exports.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/exports/exports.go b/exports/exports.go
index c4943f1..9f2d83a 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -10,7 +10,7 @@ import "github.com/jwijenbergh/eduvpn-common/src"
// Functions here should probably not take string parameters, see https://pkg.go.dev/cmd/cgo#hdr-C_references_to_Go
// GetOrganizationsList gets the list of organizations from the disco server.
-// Returns the unix timestamp of the data. This is used as key for looking up data.
+// Returns the json data as a string and an error code. This is used as key for looking up data.
//export GetOrganizationsList
func GetOrganizationsList() (*C.char, int8) {
body, err := eduvpn.GetOrganizationsList()
@@ -20,6 +20,17 @@ func GetOrganizationsList() (*C.char, int8) {
return C.CString(body), 0
}
+// GetServersList gets the list of servers from the disco server.
+// Returns the json data as a string and an error code. This is used as key for looking up data.
+//export GetServersList
+func GetServersList() (*C.char, int8) {
+ body, err := eduvpn.GetOrganizationsList()
+ if err != nil {
+ return nil, int8(err.(eduvpn.RequestError).Code)
+ }
+ return C.CString(body), 0
+}
+
//export FreeString
func FreeString(addr *C.char) {
C.free(unsafe.Pointer(addr))