summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2022-02-11 13:58:50 +0100
committerjwijenbergh <jeroenwijenbergh@protonmail.com>2022-04-05 12:26:10 +0200
commit12a0a2700d64f99b8f14d03c8de1c1ea5e922eff (patch)
treedfc59a5d11d407b2ec91bf9e7987835f16e62458 /exports
parent03649c96c57e1bc6db026871489c02d4937f0439 (diff)
Begin exposing functions using a map
Signed-off-by: jwijenbergh <jeroenwijenbergh@protonmail.com>
Diffstat (limited to 'exports')
-rw-r--r--exports/Makefile2
-rw-r--r--exports/exports.go13
2 files changed, 14 insertions, 1 deletions
diff --git a/exports/Makefile b/exports/Makefile
index a23f211..86dbec2 100644
--- a/exports/Makefile
+++ b/exports/Makefile
@@ -16,7 +16,7 @@ endif
# Build shared library and remove lib prefix (if any) from header name
# GOOS and GOARCH envvars are set by common.mk
# This extra target prevents unnecessary rebuild
-lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): exports.go ../src/verify.go
+lib/$(GOOS)/$(GOARCH)/$(LIB_FILE): exports.go ../src/*.go
CGO_ENABLED=1 go build -o $@ -buildmode=c-shared $<
mv lib/$(GOOS)/$(GOARCH)/$(LIB_PREFIX)$(LIB_NAME).h lib/$(GOOS)/$(GOARCH)/$(LIB_NAME).h || true # Normalize header name
diff --git a/exports/exports.go b/exports/exports.go
index 9ea8cba..43dfb9e 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -5,6 +5,19 @@ import "C"
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.
+//export GetOrganizationsList
+func GetOrganizationsList() uint64 {
+ return eduvpn.GetOrganizationsList()
+}
+
+// GetServerList gets the list of servers from the disco server.
+// Returns the unix timestamp of the data. This is used as key for looking up data.
+//export GetServerList
+func GetServerList() uint64 {
+ return eduvpn.GetServerList()
+}
// Verify verifies a signature on a JSON file. See eduvpn.Verify for more details.
// It returns 0 for a valid signature and a nonzero eduvpn.VerifyErrorCode otherwise.