summaryrefslogtreecommitdiff
path: root/exports
diff options
context:
space:
mode:
authorjwijenbergh <jeroenwijenbergh@protonmail.com>2023-05-02 13:06:50 +0200
committerJeroen Wijenbergh <46386452+jwijenbergh@users.noreply.github.com>2023-09-25 09:43:37 +0200
commitd0f4303ee5ccecc876fdfae1ce858369e3a323b7 (patch)
tree64bda3971398aa56f0672bab49a63a077bf6ae7c /exports
parentdc7425beb85ea7d35e860a5df2bc0d8ddda8c28a (diff)
Client + FSM: Check transitions and add SetState
Also make sure GotConfig can be used to go back to
Diffstat (limited to 'exports')
-rw-r--r--exports/exports.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/exports/exports.go b/exports/exports.go
index ae741d7..5e62e4d 100644
--- a/exports/exports.go
+++ b/exports/exports.go
@@ -512,6 +512,17 @@ func StartFailover(c C.uintptr_t, gateway *C.char, mtu C.int, readRxBytes C.Read
return droppedC, nil
}
+// SetState sets the state of the statemachine
+// Note that this transitions the FSM into the new state without passing any data to it
+//export SetState
+func SetState(fsmState C.int) *C.char {
+ state, stateErr := getVPNState()
+ if stateErr != nil {
+ return getCError(stateErr)
+ }
+ return getCError(state.SetState(client.FSMStateID(fsmState)))
+}
+
// FreeString frees a string that was allocated by the eduvpn-common Go library
// This happens when we return strings, such as errors from the Go lib back to the client
// The client MUST thus ensure that this memory is freed using this function